Skip to content

Commit

Permalink
hwmon: (npcm750-pwm-fan) Use devm_thermal_of_cooling_device_register
Browse files Browse the repository at this point in the history
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: f1fd4a4 ("hwmon: Add NPCM7xx PWM and Fan driver")
Cc: Tomer Maimon <[email protected]>
Signed-off-by: Guenter Roeck <[email protected]>
Signed-off-by: Eduardo Valentin <[email protected]>
  • Loading branch information
groeck authored and Eduardo Valentin committed May 14, 2019
1 parent 9ebe010 commit 0b2a785
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions drivers/hwmon/npcm750-pwm-fan.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 0b2a785

Please sign in to comment.