<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/hwmon/hwmon.c, branch linux-5.19.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.19.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.19.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2022-05-22T18:32:32Z</updated>
<entry>
<title>hwmon: Directly use ida_alloc()/free()</title>
<updated>2022-05-22T18:32:32Z</updated>
<author>
<name>keliu</name>
</author>
<published>2022-05-17T06:31:25Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=718fbfa5da5da0b4d030e14ed737c228ca6a7cbf'/>
<id>urn:sha1:718fbfa5da5da0b4d030e14ed737c228ca6a7cbf</id>
<content type='text'>
Use ida_alloc()/ida_free() instead of deprecated
ida_simple_get()/ida_simple_remove() .

Signed-off-by: keliu &lt;liuke94@huawei.com&gt;
Link: https://lore.kernel.org/r/20220517063126.2142637-1-liuke94@huawei.com
Signed-off-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
</content>
</entry>
<entry>
<title>hwmon: Make chip parameter for with_info API mandatory</title>
<updated>2022-05-22T18:32:31Z</updated>
<author>
<name>Guenter Roeck</name>
</author>
<published>2022-05-11T13:22:51Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ddaefa209c4ac791c1262e97c9b2d0440c8ef1d5'/>
<id>urn:sha1:ddaefa209c4ac791c1262e97c9b2d0440c8ef1d5</id>
<content type='text'>
Various attempts were made recently to "convert" the old
hwmon_device_register() API to devm_hwmon_device_register_with_info()
by just changing the function name without actually converting the
driver. Prevent this from happening by making the 'chip' parameter of
devm_hwmon_device_register_with_info() mandatory.

Signed-off-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
</content>
</entry>
<entry>
<title>hwmon: Introduce hwmon_device_register_for_thermal</title>
<updated>2022-05-22T18:32:31Z</updated>
<author>
<name>Guenter Roeck</name>
</author>
<published>2022-05-11T13:29:59Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e5d21072054fbadf41cd56062a3a14e447e8c22b'/>
<id>urn:sha1:e5d21072054fbadf41cd56062a3a14e447e8c22b</id>
<content type='text'>
The thermal subsystem registers a hwmon driver without providing
chip or sysfs group information. This is for legacy reasons and
would be difficult to change. At the same time, we want to enforce
that chip information is provided when registering a hwmon device
using hwmon_device_register_with_info(). To enable this, introduce
a special API for use only by the thermal subsystem.

Acked-by: Rafael J . Wysocki &lt;rafael@kernel.org&gt;
Signed-off-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
</content>
</entry>
<entry>
<title>hwmon: introduce hwmon_sanitize_name()</title>
<updated>2022-05-17T12:52:59Z</updated>
<author>
<name>Michael Walle</name>
</author>
<published>2022-04-05T09:24:51Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=1ad6c3b7ef132e1d8c5d606008069724625c8daf'/>
<id>urn:sha1:1ad6c3b7ef132e1d8c5d606008069724625c8daf</id>
<content type='text'>
More and more drivers will check for bad characters in the hwmon name
and all are using the same code snippet. Consolidate that code by adding
a new hwmon_sanitize_name() function.

Signed-off-by: Michael Walle &lt;michael@walle.cc&gt;
Reviewed-by: Tom Rix &lt;trix@redhat.com&gt;
Link: https://lore.kernel.org/r/20220405092452.4033674-2-michael@walle.cc
Signed-off-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
</content>
</entry>
<entry>
<title>hwmon: (core) Add support for pwm auto channels attribute</title>
<updated>2022-02-28T01:03:19Z</updated>
<author>
<name>Armin Wolf</name>
</author>
<published>2022-02-24T06:12:09Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e75d16e58467c5703821e12536c7dc438f3c425d'/>
<id>urn:sha1:e75d16e58467c5703821e12536c7dc438f3c425d</id>
<content type='text'>
pwm[1-*]_auto_channels_temp is documented as an official
hwmon sysfs attribute, yet there is no support for it in
the new with_info-API. Fix that.

Signed-off-by: Armin Wolf &lt;W_Armin@gmx.de&gt;
Link: https://lore.kernel.org/r/20220224061210.16452-2-W_Armin@gmx.de
Signed-off-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
</content>
</entry>
<entry>
<title>hwmon: Fix possible NULL pointer</title>
<updated>2022-02-28T01:03:17Z</updated>
<author>
<name>Paul Cercueil</name>
</author>
<published>2022-01-31T16:27:40Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=07320c91565658e117f2f86a190eec9bb64abeb6'/>
<id>urn:sha1:07320c91565658e117f2f86a190eec9bb64abeb6</id>
<content type='text'>
The recent addition of the label attribute added some code that read the
"label" device property, without checking first that "dev" was non-NULL.

Fix this issue by first checking that "dev" is non-NULL.

Fixes: ccd98cba6a18 ("hwmon: Add "label" attribute")
Signed-off-by: Paul Cercueil &lt;paul@crapouillou.net&gt;
Signed-off-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
</content>
</entry>
<entry>
<title>hwmon: Add "label" attribute</title>
<updated>2022-02-28T01:03:16Z</updated>
<author>
<name>Paul Cercueil</name>
</author>
<published>2022-01-10T18:22:56Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e1c9d6d61ddf3f34f14d3de51d6eea68683b5841'/>
<id>urn:sha1:e1c9d6d61ddf3f34f14d3de51d6eea68683b5841</id>
<content type='text'>
If a label is defined in the device tree for this device add that
to the device specific attributes. This is useful for userspace to
be able to identify an individual device when multiple identical
chips are present in the system.

Signed-off-by: Paul Cercueil &lt;paul@crapouillou.net&gt;
Tested-by: Cosmin Tanislav &lt;cosmin.tanislav@analog.com&gt;
Link: https://lore.kernel.org/r/20220110182256.30763-3-paul@crapouillou.net
Signed-off-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
</content>
</entry>
<entry>
<title>hwmon: Report attribute name with udev events</title>
<updated>2022-02-28T01:03:16Z</updated>
<author>
<name>Guenter Roeck</name>
</author>
<published>2022-01-10T22:56:25Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=7f3cc8f897634b7e2d79bc2b7105e9ae6eaf4ac2'/>
<id>urn:sha1:7f3cc8f897634b7e2d79bc2b7105e9ae6eaf4ac2</id>
<content type='text'>
Up to now udev events only report the affected hwmon device if an alert
is reported. This requires userspace to read all attributes if it wants
to know what triggered the event. Provide the attribute name with the
NAME property to help userspace find the attribute causing the event.

Signed-off-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
</content>
</entry>
<entry>
<title>hwmon: Handle failure to register sensor with thermal zone correctly</title>
<updated>2022-02-22T16:04:01Z</updated>
<author>
<name>Guenter Roeck</name>
</author>
<published>2022-02-21T16:32:14Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=1b5f517cca36292076d9e38fa6e33a257703e62e'/>
<id>urn:sha1:1b5f517cca36292076d9e38fa6e33a257703e62e</id>
<content type='text'>
If an attempt is made to a sensor with a thermal zone and it fails,
the call to devm_thermal_zone_of_sensor_register() may return -ENODEV.
This may result in crashes similar to the following.

Unable to handle kernel NULL pointer dereference at virtual address 00000000000003cd
...
Internal error: Oops: 96000021 [#1] PREEMPT SMP
...
pstate: 60400009 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : mutex_lock+0x18/0x60
lr : thermal_zone_device_update+0x40/0x2e0
sp : ffff800014c4fc60
x29: ffff800014c4fc60 x28: ffff365ee3f6e000 x27: ffffdde218426790
x26: ffff365ee3f6e000 x25: 0000000000000000 x24: ffff365ee3f6e000
x23: ffffdde218426870 x22: ffff365ee3f6e000 x21: 00000000000003cd
x20: ffff365ee8bf3308 x19: ffffffffffffffed x18: 0000000000000000
x17: ffffdde21842689c x16: ffffdde1cb7a0b7c x15: 0000000000000040
x14: ffffdde21a4889a0 x13: 0000000000000228 x12: 0000000000000000
x11: 0000000000000000 x10: 0000000000000000 x9 : 0000000000000000
x8 : 0000000001120000 x7 : 0000000000000001 x6 : 0000000000000000
x5 : 0068000878e20f07 x4 : 0000000000000000 x3 : 00000000000003cd
x2 : ffff365ee3f6e000 x1 : 0000000000000000 x0 : 00000000000003cd
Call trace:
 mutex_lock+0x18/0x60
 hwmon_notify_event+0xfc/0x110
 0xffffdde1cb7a0a90
 0xffffdde1cb7a0b7c
 irq_thread_fn+0x2c/0xa0
 irq_thread+0x134/0x240
 kthread+0x178/0x190
 ret_from_fork+0x10/0x20
Code: d503201f d503201f d2800001 aa0103e4 (c8e47c02)

Jon Hunter reports that the exact call sequence is:

hwmon_notify_event()
  --&gt; hwmon_thermal_notify()
    --&gt; thermal_zone_device_update()
      --&gt; update_temperature()
        --&gt; mutex_lock()

The hwmon core needs to handle all errors returned from calls
to devm_thermal_zone_of_sensor_register(). If the call fails
with -ENODEV, report that the sensor was not attached to a
thermal zone  but continue to register the hwmon device.

Reported-by: Jon Hunter &lt;jonathanh@nvidia.com&gt;
Cc: Dmitry Osipenko &lt;digetx@gmail.com&gt;
Fixes: 1597b374af222 ("hwmon: Add notification support")
Reviewed-by: Dmitry Osipenko &lt;dmitry.osipenko@collabora.com&gt;
Tested-by: Jon Hunter &lt;jonathanh@nvidia.com&gt;
Signed-off-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
</content>
</entry>
<entry>
<title>hwmon: Fix possible memleak in __hwmon_device_register()</title>
<updated>2021-10-12T14:22:01Z</updated>
<author>
<name>Yang Yingliang</name>
</author>
<published>2021-10-12T11:27:58Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ada61aa0b1184a8fda1a89a340c7d6cc4e59aee5'/>
<id>urn:sha1:ada61aa0b1184a8fda1a89a340c7d6cc4e59aee5</id>
<content type='text'>
I got memory leak as follows when doing fault injection test:

unreferenced object 0xffff888102740438 (size 8):
  comm "27", pid 859, jiffies 4295031351 (age 143.992s)
  hex dump (first 8 bytes):
    68 77 6d 6f 6e 30 00 00                          hwmon0..
  backtrace:
    [&lt;00000000544b5996&gt;] __kmalloc_track_caller+0x1a6/0x300
    [&lt;00000000df0d62b9&gt;] kvasprintf+0xad/0x140
    [&lt;00000000d3d2a3da&gt;] kvasprintf_const+0x62/0x190
    [&lt;000000005f8f0f29&gt;] kobject_set_name_vargs+0x56/0x140
    [&lt;00000000b739e4b9&gt;] dev_set_name+0xb0/0xe0
    [&lt;0000000095b69c25&gt;] __hwmon_device_register+0xf19/0x1e50 [hwmon]
    [&lt;00000000a7e65b52&gt;] hwmon_device_register_with_info+0xcb/0x110 [hwmon]
    [&lt;000000006f181e86&gt;] devm_hwmon_device_register_with_info+0x85/0x100 [hwmon]
    [&lt;0000000081bdc567&gt;] tmp421_probe+0x2d2/0x465 [tmp421]
    [&lt;00000000502cc3f8&gt;] i2c_device_probe+0x4e1/0xbb0
    [&lt;00000000f90bda3b&gt;] really_probe+0x285/0xc30
    [&lt;000000007eac7b77&gt;] __driver_probe_device+0x35f/0x4f0
    [&lt;000000004953d43d&gt;] driver_probe_device+0x4f/0x140
    [&lt;000000002ada2d41&gt;] __device_attach_driver+0x24c/0x330
    [&lt;00000000b3977977&gt;] bus_for_each_drv+0x15d/0x1e0
    [&lt;000000005bf2a8e3&gt;] __device_attach+0x267/0x410

When device_register() returns an error, the name allocated in
dev_set_name() will be leaked, the put_device() should be used
instead of calling hwmon_dev_release() to give up the device
reference, then the name will be freed in kobject_cleanup().

Reported-by: Hulk Robot &lt;hulkci@huawei.com&gt;
Fixes: bab2243ce189 ("hwmon: Introduce hwmon_device_register_with_groups")
Signed-off-by: Yang Yingliang &lt;yangyingliang@huawei.com&gt;
Link: https://lore.kernel.org/r/20211012112758.2681084-1-yangyingliang@huawei.com
Signed-off-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
</content>
</entry>
</feed>
