lkml.org 
[lkml]   [2019]   [May]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v3 01/11] platform/x86: asus-wmi: Fix hwmon device cleanup
On Fri, Apr 19, 2019 at 1:00 PM Yurii Pavlovskyi
<yurii.pavlovskyi@gmail.com> 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

\
 
 \ /
  Last update: 2019-05-08 15:26    [W:0.217 / U:4.156 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site