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 --- src/fw/pciinit.c | 23 +++++++---------------- 1 file 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 */