From 744d6bd638f5e9495a4d0032135a6e12bf1befbd Mon Sep 17 00:00:00 2001 From: Nico Huber Date: Sat, 12 Jan 2019 14:58:20 +0100 Subject: sb/intel: Check for NULL-return of pcidev_on_root() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In these cases we have to expect a NULL pointer because the IGD device 0:2.0 may be disabled. The behaviour still differs from using dev_find_slot(), which may return a disabled device. Though, if you'd try to read its config space you'd only read garbage (0xff) and in cases where we filled ACPI data with devicetree information, the information shouldn't be interpreted by the OS because of the disabled device. Change-Id: I1bab8fa3a82daca71d03453315cdd69d8951fc24 Signed-off-by: Nico Huber Reviewed-on: https://review.coreboot.org/c/30879 Reviewed-by: Kyösti Mälkki Reviewed-by: Angel Pons Tested-by: build bot (Jenkins) --- src/southbridge/intel/i82801ix/lpc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/southbridge/intel/i82801ix') diff --git a/src/southbridge/intel/i82801ix/lpc.c b/src/southbridge/intel/i82801ix/lpc.c index dd37a0bd74..e18f616b82 100644 --- a/src/southbridge/intel/i82801ix/lpc.c +++ b/src/southbridge/intel/i82801ix/lpc.c @@ -545,8 +545,10 @@ static void southbridge_inject_dsdt(struct device *dev) memset(gnvs, 0, sizeof(*gnvs)); acpi_create_gnvs(gnvs); - gnvs->ndid = gfx->ndid; - memcpy(gnvs->did, gfx->did, sizeof(gnvs->did)); + if (gfx) { + gnvs->ndid = gfx->ndid; + memcpy(gnvs->did, gfx->did, sizeof(gnvs->did)); + } /* And tell SMI about it */ smm_setup_structures(gnvs, NULL, NULL); -- cgit v1.2.3