From 114cf22e8d9881aedc9ee72af5dfac74fdff5627 Mon Sep 17 00:00:00 2001 From: Martin Roth Date: Tue, 28 Jul 2020 09:42:07 -0600 Subject: drivers/amd/i2s_machine_dev: return if scope is NULL Avoid dereferencing a null pointer. Found-by: Coverity CID 1430549 BUG=None TEST=Build Signed-off-by: Martin Roth Change-Id: I53f6a38aac6e7f94c3c370996b3b82ca0d88dac4 Reviewed-on: https://review.coreboot.org/c/coreboot/+/44001 Tested-by: build bot (Jenkins) Reviewed-by: Furquan Shaikh --- src/drivers/amd/i2s_machine_dev/i2s_machine_dev.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/drivers/amd/i2s_machine_dev/i2s_machine_dev.c b/src/drivers/amd/i2s_machine_dev/i2s_machine_dev.c index a93826551d..b5be31d038 100644 --- a/src/drivers/amd/i2s_machine_dev/i2s_machine_dev.c +++ b/src/drivers/amd/i2s_machine_dev/i2s_machine_dev.c @@ -21,6 +21,11 @@ static void i2s_machine_dev_fill_ssdt(const struct device *dev) dmic_select_gpio = &cfg->dmic_select_gpio; + if (scope == NULL) { + printk(BIOS_ERR, "%s: ERROR: ACPI I2S scope not found\n", dev_path(dev)); + return; + } + if (cfg->hid == NULL) { printk(BIOS_ERR, "%s: ERROR: HID required\n", dev_path(dev)); return; -- cgit v1.2.3