Skip to content

Commit

Permalink
int340x_thermal/processor_thermal_device: return failure when
Browse files Browse the repository at this point in the history
 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 <yu.c.chen@intel.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Tested-by: Chen Yu <yu.c.chen@intel.com>
  • Loading branch information
Zhang Rui committed Jan 6, 2015
1 parent 014d9d5 commit ad0f409
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/thermal/int340x_thermal/processor_thermal_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit ad0f409

Please sign in to comment.