From 834543c0c71544b547194b093b8e1da990722762 Mon Sep 17 00:00:00 2001 From: Subrata Banik Date: Sat, 6 Oct 2018 13:58:33 +0530 Subject: [PATCH] =?UTF-8?q?soc/intel/skylake:=20Fix=20=E2=80=98dev?= =?UTF-8?q?=E2=80=99=20pointer=20NULL=20before=20being=20dereferenced?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch fixes KW issue due to pointer being NULL and will be dereferenced Change-Id: Iedb59daf5f448e31c0097873a086e4d08cd4a979 Signed-off-by: Subrata Banik Reviewed-on: https://review.coreboot.org/28948 Reviewed-by: Aaron Durbin Reviewed-by: Furquan Shaikh Tested-by: build bot (Jenkins) --- src/soc/intel/skylake/cpu.c | 4 ++++ src/soc/intel/skylake/thermal.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/soc/intel/skylake/cpu.c b/src/soc/intel/skylake/cpu.c index 3733fe000c..7a66ed0e33 100644 --- a/src/soc/intel/skylake/cpu.c +++ b/src/soc/intel/skylake/cpu.c @@ -290,6 +290,10 @@ static void configure_isst(void) static void configure_misc(void) { struct device *dev = SA_DEV_ROOT; + if (!dev) { + printk(BIOS_ERR, "SA_DEV_ROOT device not found!\n"); + return; + } config_t *conf = dev->chip_info; msr_t msr; diff --git a/src/soc/intel/skylake/thermal.c b/src/soc/intel/skylake/thermal.c index 01a4f26259..c1b4ce31d4 100644 --- a/src/soc/intel/skylake/thermal.c +++ b/src/soc/intel/skylake/thermal.c @@ -83,6 +83,10 @@ void pch_thermal_configuration(void) { uint16_t reg16; struct device *dev = PCH_DEV_THERMAL; + if (!dev) { + printk(BIOS_ERR, "PCH_DEV_THERMAL device not found!\n"); + return; + } void *thermalbar = pch_thermal_get_bar(dev); /* Use default pre-ram bar */