From 137f41f2d405e050f539cf06b1e29b8ee77915fa Mon Sep 17 00:00:00 2001 From: Jacob Garber Date: Mon, 15 Jul 2019 13:18:00 -0600 Subject: [PATCH] mb/amd/serengeti_cheetah_fam10: Add null pointer check Print an error message and die if the PCI device cannot be found. Change-Id: I10c58502658ebf12d1a8fe826ee7d47a618fd1c8 Signed-off-by: Jacob Garber Found-by: Coverity CID 1403000 Reviewed-on: https://review.coreboot.org/c/coreboot/+/34353 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi --- src/mainboard/amd/serengeti_cheetah_fam10/get_bus_conf.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mainboard/amd/serengeti_cheetah_fam10/get_bus_conf.c b/src/mainboard/amd/serengeti_cheetah_fam10/get_bus_conf.c index e1f2409504..82670bd586 100644 --- a/src/mainboard/amd/serengeti_cheetah_fam10/get_bus_conf.c +++ b/src/mainboard/amd/serengeti_cheetah_fam10/get_bus_conf.c @@ -37,6 +37,9 @@ static u32 get_hcid(u32 i) dev = dev_find_slot(busn, PCI_DEVFN(devn,0)); + if (dev == NULL) + die("ERROR - could not find PCI %02x:%02x.0\n", busn, PCI_DEVFN(devn, 0)); + switch (dev->device) { case 0x7458: /* 8132 */ id = 1;