Commit 0b2a785d authored by Guenter Roeck's avatar Guenter Roeck Committed by Eduardo Valentin

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: f1fd4a4d ("hwmon: Add NPCM7xx PWM and Fan driver")
Cc: Tomer Maimon <tmaimon77@gmail.com>
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
Signed-off-by: default avatarEduardo Valentin <edubezval@gmail.com>
parent 9ebe010e
...@@ -864,10 +864,8 @@ static int npcm7xx_create_pwm_cooling(struct device *dev, ...@@ -864,10 +864,8 @@ static int npcm7xx_create_pwm_cooling(struct device *dev,
snprintf(cdev->name, THERMAL_NAME_LENGTH, "%pOFn%d", child, snprintf(cdev->name, THERMAL_NAME_LENGTH, "%pOFn%d", child,
pwm_port); pwm_port);
cdev->tcdev = thermal_of_cooling_device_register(child, cdev->tcdev = devm_thermal_of_cooling_device_register(dev, child,
cdev->name, cdev->name, cdev, &npcm7xx_pwm_cool_ops);
cdev,
&npcm7xx_pwm_cool_ops);
if (IS_ERR(cdev->tcdev)) if (IS_ERR(cdev->tcdev))
return PTR_ERR(cdev->tcdev); return PTR_ERR(cdev->tcdev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment