thermal: hwmon: Make the check for critical temp valid consistent
authorAaron Lu <aaron.lu@intel.com>
Wed, 21 May 2014 08:33:27 +0000 (16:33 +0800)
committerZhang Rui <rui.zhang@intel.com>
Mon, 30 Jun 2014 02:17:27 +0000 (10:17 +0800)
commite8db5d6736a712a3e2280c0e31f4b301d85172d8
tree046ef84dcb4d9395070b0491da0f6bc0f9914a2f
parentf14d1c24c64bec45c01b0bc7b0dde2e54a797662
thermal: hwmon: Make the check for critical temp valid consistent

On 05/21/2014 04:22 PM, Aaron Lu wrote:
> On 05/21/2014 01:57 PM, Kui Zhang wrote:
>> Hello,
>>
>> I get following error when rmmod thermal.
>>
>> rmmod  thermal
>> Killed

While dealing with this problem, I found another problem that also
results in a kernel crash on thermal module removal:

From: Aaron Lu <aaron.lu@intel.com>
Date: Wed, 21 May 2014 16:05:38 +0800
Subject: [PATCH] thermal: hwmon: Make the check for critical temp valid consistent

We used the tz->ops->get_crit_temp && !tz->ops->get_crit_temp(tz, temp)
to decide if we need to create the temp_crit attribute file but we just
check if tz->ops->get_crit_temp exists to decide if we need to remove
that attribute file. Some ACPI thermal zone doesn't have a valid critical
trip point and that would result in removing a non-existent device file
on thermal module unload.

Cc: All applicable <stable@vger.kernel.org>
Signed-off-by: Aaron Lu <aaron.lu@intel.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
drivers/thermal/thermal_hwmon.c