PCI/MSI: Consolidate error handling in msi_capability_init()

Three error exits doing exactly the same ask for a common error exit point.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Marc Zyngier <maz@kernel.org>
Reviewed-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20210729222543.098828720@linutronix.de
This commit is contained in:
Thomas Gleixner 2021-07-29 23:51:54 +02:00
parent 67961e77a3
commit 8eb5ce3f78
1 changed files with 11 additions and 15 deletions

View File

@ -659,25 +659,16 @@ static int msi_capability_init(struct pci_dev *dev, int nvec,
/* Configure MSI capability structure */ /* Configure MSI capability structure */
ret = pci_msi_setup_msi_irqs(dev, nvec, PCI_CAP_ID_MSI); ret = pci_msi_setup_msi_irqs(dev, nvec, PCI_CAP_ID_MSI);
if (ret) { if (ret)
msi_mask_irq(entry, mask, 0); goto err;
free_msi_irqs(dev);
return ret;
}
ret = msi_verify_entries(dev); ret = msi_verify_entries(dev);
if (ret) { if (ret)
msi_mask_irq(entry, mask, 0); goto err;
free_msi_irqs(dev);
return ret;
}
ret = populate_msi_sysfs(dev); ret = populate_msi_sysfs(dev);
if (ret) { if (ret)
msi_mask_irq(entry, mask, 0); goto err;
free_msi_irqs(dev);
return ret;
}
/* Set MSI enabled bits */ /* Set MSI enabled bits */
pci_intx_for_msi(dev, 0); pci_intx_for_msi(dev, 0);
@ -687,6 +678,11 @@ static int msi_capability_init(struct pci_dev *dev, int nvec,
pcibios_free_irq(dev); pcibios_free_irq(dev);
dev->irq = entry->irq; dev->irq = entry->irq;
return 0; return 0;
err:
msi_mask_irq(entry, mask, 0);
free_msi_irqs(dev);
return ret;
} }
static void __iomem *msix_map_region(struct pci_dev *dev, unsigned nr_entries) static void __iomem *msix_map_region(struct pci_dev *dev, unsigned nr_entries)