Skip to content

Commit 2adc790

Browse files
Alexander Gordeevbjorn-helgaas
authored andcommitted
PCI/MSI: Return msix_capability_init() failure if populate_msi_sysfs() fails
If populate_msi_sysfs() function failed msix_capability_init() must return the error code, but it returns the success instead. This update fixes the described misbehaviour. Signed-off-by: Alexander Gordeev <agordeev@redhat.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Tejun Heo <tj@kernel.org>
1 parent 57b7cb0 commit 2adc790

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

drivers/pci/msi.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,7 @@ static int msix_capability_init(struct pci_dev *dev,
749749

750750
ret = arch_setup_msi_irqs(dev, nvec, PCI_CAP_ID_MSIX);
751751
if (ret)
752-
goto error;
752+
goto out_avail;
753753

754754
/*
755755
* Some devices require MSI-X to be enabled before we can touch the
@@ -762,10 +762,8 @@ static int msix_capability_init(struct pci_dev *dev,
762762
msix_program_entries(dev, entries);
763763

764764
ret = populate_msi_sysfs(dev);
765-
if (ret) {
766-
ret = 0;
767-
goto error;
768-
}
765+
if (ret)
766+
goto out_free;
769767

770768
/* Set MSI-X enabled bits and unmask the function */
771769
pci_intx_for_msi(dev, 0);
@@ -776,7 +774,7 @@ static int msix_capability_init(struct pci_dev *dev,
776774

777775
return 0;
778776

779-
error:
777+
out_avail:
780778
if (ret < 0) {
781779
/*
782780
* If we had some success, report the number of irqs
@@ -793,6 +791,7 @@ static int msix_capability_init(struct pci_dev *dev,
793791
ret = avail;
794792
}
795793

794+
out_free:
796795
free_msi_irqs(dev);
797796

798797
return ret;

0 commit comments

Comments
 (0)