hwmon: (npcm750-pwm-fan) Use devm_thermal_of_cooling_device_register
Use devm_thermal_of_cooling_device_register() to register the cooling
device. As a side effect, this fixes a driver bug:
thermal_cooling_device_unregister() was not called on device removal.
Fixes: f1fd4a4db7
("hwmon: Add NPCM7xx PWM and Fan driver")
Cc: Tomer Maimon <tmaimon77@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
This commit is contained in:
parent
9ebe010e56
commit
0b2a785db8
|
@ -864,10 +864,8 @@ static int npcm7xx_create_pwm_cooling(struct device *dev,
|
|||
snprintf(cdev->name, THERMAL_NAME_LENGTH, "%pOFn%d", child,
|
||||
pwm_port);
|
||||
|
||||
cdev->tcdev = thermal_of_cooling_device_register(child,
|
||||
cdev->name,
|
||||
cdev,
|
||||
&npcm7xx_pwm_cool_ops);
|
||||
cdev->tcdev = devm_thermal_of_cooling_device_register(dev, child,
|
||||
cdev->name, cdev, &npcm7xx_pwm_cool_ops);
|
||||
if (IS_ERR(cdev->tcdev))
|
||||
return PTR_ERR(cdev->tcdev);
|
||||
|
||||
|
|
Loading…
Reference in New Issue