mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-06 02:24:14 +08:00
platform/x86: asus-wmi: Fix hwmon device cleanup
The driver does not clean up the hwmon device on exit or error. To reproduce the bug, repeat rmmod, insmod to verify that device number /sys/devices/platform/asus-nb-wmi/hwmon/hwmon?? grows every time. Replace call for registering device with devm_* version that unregisters it automatically. Signed-off-by: Yurii Pavlovskyi <yurii.pavlovskyi@gmail.com> Reviewed-by: Daniel Drake <drake@endlessm.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
This commit is contained in:
parent
2a5753559e
commit
cd10ee006a
@ -1428,11 +1428,12 @@ __ATTRIBUTE_GROUPS(hwmon_attribute);
|
||||
|
||||
static int asus_wmi_hwmon_init(struct asus_wmi *asus)
|
||||
{
|
||||
struct device *dev = &asus->platform_device->dev;
|
||||
struct device *hwmon;
|
||||
|
||||
hwmon = hwmon_device_register_with_groups(&asus->platform_device->dev,
|
||||
"asus", asus,
|
||||
hwmon_attribute_groups);
|
||||
hwmon = devm_hwmon_device_register_with_groups(dev, "asus", asus,
|
||||
hwmon_attribute_groups);
|
||||
|
||||
if (IS_ERR(hwmon)) {
|
||||
pr_err("Could not register asus hwmon device\n");
|
||||
return PTR_ERR(hwmon);
|
||||
|
Loading…
Reference in New Issue
Block a user