diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2014-11-12 18:00:30 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2014-11-12 18:11:57 -0500 |
commit | 9f505f715793d99235bd6b4afb2ca7b96ba5729b (patch) | |
tree | 40c5291382a77572a1a238857ed4792aa2101d5b | |
parent | 83c82769d1246a00e1773764505184cb95d4f663 (diff) | |
download | seabios-9f505f715793d99235bd6b4afb2ca7b96ba5729b.zip seabios-9f505f715793d99235bd6b4afb2ca7b96ba5729b.tar.gz seabios-9f505f715793d99235bd6b4afb2ca7b96ba5729b.tar.bz2 |
pciinit: Fix build warning in mch_pci_slot_get_irq()
Some old versions of gcc warn that 'irq might be used uninitialized'.
Replace the switch statement with an if statement to suppress the
warning.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
-rw-r--r-- | src/fw/pciinit.c | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/src/fw/pciinit.c b/src/fw/pciinit.c index fd5dfb9..3e6308a 100644 --- a/src/fw/pciinit.c +++ b/src/fw/pciinit.c @@ -115,27 +115,18 @@ static int piix_pci_slot_get_irq(struct pci_device *pci, int pin) static int mch_pci_slot_get_irq(struct pci_device *pci, int pin) { - int irq, slot, pin_addend = 0; - + int pin_addend = 0; while (pci->parent != NULL) { pin_addend += pci_bdf_to_dev(pci->bdf); pci = pci->parent; } - slot = pci_bdf_to_dev(pci->bdf); - - switch (slot) { - /* Slots 0-24 rotate slot:pin mapping similar to piix above, but - with a different starting index - see q35-acpi-dsdt.dsl */ - case 0 ... 24: - irq = pci_irqs[(pin - 1 + pin_addend + slot) & 3]; - break; + u8 slot = pci_bdf_to_dev(pci->bdf); + if (slot <= 24) + /* Slots 0-24 rotate slot:pin mapping similar to piix above, but + with a different starting index - see q35-acpi-dsdt.dsl */ + return pci_irqs[(pin - 1 + pin_addend + slot) & 3]; /* Slots 25-31 all use LNKA mapping (or LNKE, but A:D = E:H) */ - case 25 ... 31: - irq = pci_irqs[(pin - 1 + pin_addend) & 3]; - break; - } - - return irq; + return pci_irqs[(pin - 1 + pin_addend) & 3]; } /* PIIX3/PIIX4 PCI to ISA bridge */ |