hwmon: (gpio-fan) Use devm_thermal_of_cooling_device_register
authorGuenter Roeck <linux@roeck-us.net>
Thu, 18 Apr 2019 19:58:17 +0000 (12:58 -0700)
committerEduardo Valentin <edubezval@gmail.com>
Tue, 14 May 2019 14:00:45 +0000 (07:00 -0700)
commit9534784550ab02a4394f499ff60765e89bc88f22
treea98ed4ffa76c8805a196eda519af90e1c5e54ba6
parent389c0ad1d61ec5790174ecb0f01eac13423a18e1
hwmon: (gpio-fan) Use devm_thermal_of_cooling_device_register

Call devm_thermal_of_cooling_device_register() to register the cooling
device. Also use devm_add_action_or_reset() to stop the fan on device
removal. This fixes a race condition since the fan was stopped before
the hwmon device was removed.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
drivers/hwmon/gpio-fan.c