]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
hwmon: (coretemp) Fix oops on driver load
authorJean Delvare <khali@linux-fr.org>
Thu, 1 Dec 2011 16:21:28 +0000 (17:21 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 9 Dec 2011 16:52:34 +0000 (08:52 -0800)
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 <khali@linux-fr.org>
Acked-by: Durgadoss R <durgadoss.r@intel.com>
Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/hwmon/coretemp.c

index f64219408415758fe15cbfdb01b9643edb1d2a01..835ae427d85193d5da9764f287f8a8a1070a0880 100644 (file)
@@ -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)