]> git.baikalelectronics.ru Git - kernel.git/commitdiff
genirq/msi: Populate sysfs entry only once
authorThomas Gleixner <tglx@linutronix.de>
Mon, 10 Jan 2022 18:12:45 +0000 (19:12 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Mon, 10 Jan 2022 18:22:10 +0000 (19:22 +0100)
The MSI entries for multi-MSI are populated en bloc for the MSI descriptor,
but the current code invokes the population inside the per interrupt loop
which triggers a warning in the sysfs code and causes the interrupt
allocation to fail.

Move it outside of the loop so it works correctly for single and multi-MSI.

Fixes: 77b242da0928 ("genirq/msi: Simplify sysfs handling")
Reported-by: Borislav Petkov <bp@alien8.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Borislav Petkov <bp@suse.de>
Link: https://lore.kernel.org/r/87leznqx2a.ffs@tglx
kernel/irq/msi.c

index 173bc04f9fe598bdd1fce22c9785285fff5ed5f8..2bdfce5edafd025344c38c47c91e97be623fbac4 100644 (file)
@@ -887,12 +887,11 @@ int __msi_domain_alloc_irqs(struct irq_domain *domain, struct device *dev,
                        ret = msi_init_virq(domain, virq + i, vflags);
                        if (ret)
                                return ret;
-
-                       if (info->flags & MSI_FLAG_DEV_SYSFS) {
-                               ret = msi_sysfs_populate_desc(dev, desc);
-                               if (ret)
-                                       return ret;
-                       }
+               }
+               if (info->flags & MSI_FLAG_DEV_SYSFS) {
+                       ret = msi_sysfs_populate_desc(dev, desc);
+                       if (ret)
+                               return ret;
                }
                allocated++;
        }