From: Jean Delvare Date: Thu, 1 Dec 2011 16:21:28 +0000 (+0100) Subject: hwmon: (coretemp) Fix oops on driver load X-Git-Tag: firefly_0821_release~7541^2~2181 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=0500898d30ba531cc932c2db171bf2f27ca78abe;p=firefly-linux-kernel-4.4.55.git hwmon: (coretemp) Fix oops on driver load This is for stable kernel branch 3.0 only. Previous and later versions have different code paths and are not affected by this bug. If the CPU microcode is too old, the coretemp driver won't work. But instead of failing gracefully, it currently oops. Check for NULL platform device data to avoid this. Signed-off-by: Jean Delvare Acked-by: Durgadoss R Acked-by: Guenter Roeck Cc: Fenghua Yu Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c index f64219408415..835ae427d851 100644 --- a/drivers/hwmon/coretemp.c +++ b/drivers/hwmon/coretemp.c @@ -539,6 +539,8 @@ static void coretemp_add_core(unsigned int cpu, int pkg_flag) return; pdata = platform_get_drvdata(pdev); + if (!pdata) + return; err = create_core_data(pdata, pdev, cpu, pkg_flag); if (err)