From: Zhang Rui Date: Sun, 4 Jan 2015 08:35:59 +0000 (+0800) Subject: int340x_thermal/processor_thermal_device: return failure when X-Git-Tag: v4.9.8~5011^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ad0f409051a67dde8d454990e09b6db41f675876;p=platform%2Fkernel%2Flinux-rpi3.git int340x_thermal/processor_thermal_device: return failure when there is no ACPI device object processor_thermal_device driver needs ACPI support to work. Thus, the driver probing should fail when there is no ACPI device object asscociated. This fixes a NULL pointer dereference when the driver is loaded with INT340X feature disabled in BIOS. Reported-by: Chen Yu Signed-off-by: Zhang Rui Tested-by: Chen Yu --- diff --git a/drivers/thermal/int340x_thermal/processor_thermal_device.c b/drivers/thermal/int340x_thermal/processor_thermal_device.c index 31bb553..0fe5dbb 100644 --- a/drivers/thermal/int340x_thermal/processor_thermal_device.c +++ b/drivers/thermal/int340x_thermal/processor_thermal_device.c @@ -130,6 +130,8 @@ static int proc_thermal_add(struct device *dev, int ret; adev = ACPI_COMPANION(dev); + if (!adev) + return -ENODEV; status = acpi_evaluate_object(adev->handle, "PPCC", NULL, &buf); if (ACPI_FAILURE(status))