diff options
author | Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> | 2023-09-11 15:53:49 +0300 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2023-10-10 16:26:56 -0500 |
commit | 7d52f538cef8d56b179eace7c796d9edb3094dad (patch) | |
tree | 9a66d6402cbf10401215352460c74c3cb35240de /arch/alpha | |
parent | 0bb80ecc33a8fb5a682236443c1e740d5c917d1d (diff) | |
download | linux-7d52f538cef8d56b179eace7c796d9edb3094dad.tar.gz linux-7d52f538cef8d56b179eace7c796d9edb3094dad.tar.bz2 linux-7d52f538cef8d56b179eace7c796d9edb3094dad.zip |
alpha: Streamline convoluted PCI error handling
miata_map_irq() handles PCI device and read config related errors in a
conditional block that is more complex than necessary.
Streamline the code flow and error handling.
No functional changes intended.
Link: https://lore.kernel.org/r/20230911125354.25501-2-ilpo.jarvinen@linux.intel.com
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'arch/alpha')
-rw-r--r-- | arch/alpha/kernel/sys_miata.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/arch/alpha/kernel/sys_miata.c b/arch/alpha/kernel/sys_miata.c index e1bee8f84c58..33b2798de8fc 100644 --- a/arch/alpha/kernel/sys_miata.c +++ b/arch/alpha/kernel/sys_miata.c @@ -183,16 +183,17 @@ miata_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) the 2nd 8259 controller. So we have to check for it first. */ if((slot == 7) && (PCI_FUNC(dev->devfn) == 3)) { - u8 irq=0; struct pci_dev *pdev = pci_get_slot(dev->bus, dev->devfn & ~7); - if(pdev == NULL || pci_read_config_byte(pdev, 0x40,&irq) != PCIBIOS_SUCCESSFUL) { - pci_dev_put(pdev); + u8 irq = 0; + int ret; + + if (!pdev) return -1; - } - else { - pci_dev_put(pdev); - return irq; - } + + ret = pci_read_config_byte(pdev, 0x40, &irq); + pci_dev_put(pdev); + + return ret == PCIBIOS_SUCCESSFUL ? irq : -1; } return COMMON_TABLE_LOOKUP; |