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 <jgarber1@ualberta.ca>
Found-by: Coverity CID 1403000
Reviewed-on: https://review.coreboot.org/c/coreboot/+/34353
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
This commit is contained in:
Jacob Garber 2019-07-15 13:18:00 -06:00 committed by Patrick Georgi
parent 8216b46d7b
commit 137f41f2d4
1 changed files with 3 additions and 0 deletions

View File

@ -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;