Skip to content

Commit 7d52f53

Browse files
ij-intelbjorn-helgaas
authored andcommitted
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/[email protected] Signed-off-by: Ilpo Järvinen <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]>
1 parent 0bb80ec commit 7d52f53

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

arch/alpha/kernel/sys_miata.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -183,16 +183,17 @@ miata_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
183183
the 2nd 8259 controller. So we have to check for it first. */
184184

185185
if((slot == 7) && (PCI_FUNC(dev->devfn) == 3)) {
186-
u8 irq=0;
187186
struct pci_dev *pdev = pci_get_slot(dev->bus, dev->devfn & ~7);
188-
if(pdev == NULL || pci_read_config_byte(pdev, 0x40,&irq) != PCIBIOS_SUCCESSFUL) {
189-
pci_dev_put(pdev);
187+
u8 irq = 0;
188+
int ret;
189+
190+
if (!pdev)
190191
return -1;
191-
}
192-
else {
193-
pci_dev_put(pdev);
194-
return irq;
195-
}
192+
193+
ret = pci_read_config_byte(pdev, 0x40, &irq);
194+
pci_dev_put(pdev);
195+
196+
return ret == PCIBIOS_SUCCESSFUL ? irq : -1;
196197
}
197198

198199
return COMMON_TABLE_LOOKUP;

0 commit comments

Comments
 (0)