Re: [PATCH v3 01/11] platform/x86: asus-wmi: Fix hwmon device cleanup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Apr 19, 2019 at 1:00 PM Yurii Pavlovskyi
<yurii.pavlovskyi@xxxxxxxxx> wrote:
>
> 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.

>         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(
> +                       &asus->platform_device->dev, "asus", asus,
> +                       hwmon_attribute_groups);
> +

Temporary variable would help with readability, i.e.

struct device *dev = &asus->platform_device->dev;
...

-- 
With Best Regards,
Andy Shevchenko



[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux