summaryrefslogtreecommitdiff
path: root/src/mainboard/emulation/qemu-q35/mainboard.c
diff options
context:
space:
mode:
authorAngel Pons <th3fanbus@gmail.com>2021-06-28 14:00:57 +0200
committerPatrick Georgi <pgeorgi@google.com>2021-07-01 09:43:09 +0000
commitc76c59aa6a62ef2fb9fa7e97ac76156b6593e4c5 (patch)
tree9fd3e4306937ac342ec7417ea0c1ad44c2ecc7e1 /src/mainboard/emulation/qemu-q35/mainboard.c
parent5124c131ba89145dfa481016038fbc8f26a86656 (diff)
QEMU: Only call `pci_assign_irqs` with non-NULL dev
Do not call `pci_assign_irqs` with a NULL device pointer. Change-Id: Ide9ae38dedd881ed673ba1838a1e29529b306937 Signed-off-by: Angel Pons <th3fanbus@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/55900 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de>
Diffstat (limited to 'src/mainboard/emulation/qemu-q35/mainboard.c')
-rw-r--r--src/mainboard/emulation/qemu-q35/mainboard.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/mainboard/emulation/qemu-q35/mainboard.c b/src/mainboard/emulation/qemu-q35/mainboard.c
index e53404d55c..534f6061a1 100644
--- a/src/mainboard/emulation/qemu-q35/mainboard.c
+++ b/src/mainboard/emulation/qemu-q35/mainboard.c
@@ -31,11 +31,17 @@ static void qemu_nb_init(struct device *dev)
pc_keyboard_init(NO_AUX_DEVICE);
/* setup IRQ routing for pci slots */
- for (i = 0; i < 25; i++)
- pci_assign_irqs(pcidev_on_root(i, 0), qemu_q35_irqs + (i % 4));
+ for (i = 0; i < 25; i++) {
+ struct device *d = pcidev_on_root(i, 0);
+ if (d)
+ pci_assign_irqs(d, qemu_q35_irqs + (i % 4));
+ }
/* setup IRQ routing southbridge devices */
- for (i = 25; i < 32; i++)
- pci_assign_irqs(pcidev_on_root(i, 0), qemu_q35_irqs);
+ for (i = 25; i < 32; i++) {
+ struct device *d = pcidev_on_root(i, 0);
+ if (d)
+ pci_assign_irqs(d, qemu_q35_irqs);
+ }
}
static void qemu_nb_read_resources(struct device *dev)