<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/hwmon/hwmon.c, branch linux-5.4.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.4.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.4.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2022-06-25T10:44:36Z</updated>
<entry>
<title>Revert "hwmon: Make chip parameter for with_info API mandatory"</title>
<updated>2022-06-25T10:44:36Z</updated>
<author>
<name>Greg Kroah-Hartman</name>
</author>
<published>2022-06-23T16:19:35Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3994d2ee55e28a08a4af4ef2ad5ced8d194d8b78'/>
<id>urn:sha1:3994d2ee55e28a08a4af4ef2ad5ced8d194d8b78</id>
<content type='text'>
This reverts commit 1ec0bc72f5dab3ab367ae5230cf6f212d805a225 which is
commit ddaefa209c4ac791c1262e97c9b2d0440c8ef1d5 upstream.  It should not
have been applied to the stable trees.

Link: https://lore.kernel.org/r/20220622154454.GA1864037@roeck-us.net
Reported-by: Julian Haller &lt;julian.haller@philips.com&gt;
Reported-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
Cc: Sasha Levin &lt;sashal@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>hwmon: Make chip parameter for with_info API mandatory</title>
<updated>2022-06-14T16:11:29Z</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=1ec0bc72f5dab3ab367ae5230cf6f212d805a225'/>
<id>urn:sha1:1ec0bc72f5dab3ab367ae5230cf6f212d805a225</id>
<content type='text'>
[ Upstream commit ddaefa209c4ac791c1262e97c9b2d0440c8ef1d5 ]

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;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>hwmon: Fix possible memleak in __hwmon_device_register()</title>
<updated>2021-11-17T08:48:37Z</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=8384c4a7bcb3a64b03d02bfcc0f0f9765a2a6dec'/>
<id>urn:sha1:8384c4a7bcb3a64b03d02bfcc0f0f9765a2a6dec</id>
<content type='text'>
[ Upstream commit ada61aa0b1184a8fda1a89a340c7d6cc4e59aee5 ]

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;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>hwmon: (core) Do not use device managed functions for memory allocations</title>
<updated>2020-01-29T15:45:24Z</updated>
<author>
<name>Guenter Roeck</name>
</author>
<published>2020-01-16T18:44:17Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=19d0cd2127428aa755907aa05828f6698e48cf87'/>
<id>urn:sha1:19d0cd2127428aa755907aa05828f6698e48cf87</id>
<content type='text'>
commit 3bf8bdcf3bada771eb12b57f2a30caee69e8ab8d upstream.

The hwmon core uses device managed functions, tied to the hwmon parent
device, for various internal memory allocations. This is problematic
since hwmon device lifetime does not necessarily match its parent's
device lifetime. If there is a mismatch, memory leaks will accumulate
until the parent device is released.

Fix the problem by managing all memory allocations internally. The only
exception is memory allocation for thermal device registration, which
can be tied to the hwmon device, along with thermal device registration
itself.

Fixes: d560168b5d0f ("hwmon: (core) New hwmon registration API")
Cc: stable@vger.kernel.org # v4.14.x: 47c332deb8e8: hwmon: Deal with errors from the thermal subsystem
Cc: stable@vger.kernel.org # v4.14.x: 74e3512731bd: hwmon: (core) Fix double-free in __hwmon_device_register()
Cc: stable@vger.kernel.org # v4.9.x: 3a412d5e4a1c: hwmon: (core) Simplify sysfs attribute name allocation
Cc: stable@vger.kernel.org # v4.9.x: 47c332deb8e8: hwmon: Deal with errors from the thermal subsystem
Cc: stable@vger.kernel.org # v4.9.x: 74e3512731bd: hwmon: (core) Fix double-free in __hwmon_device_register()
Cc: stable@vger.kernel.org # v4.9+
Cc: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
Signed-off-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>hwmon: (core) Add comment describing how hwdev is freed in error path</title>
<updated>2019-06-24T01:33:01Z</updated>
<author>
<name>Guenter Roeck</name>
</author>
<published>2019-06-06T16:43:14Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=792eac1843196708e6f72e73b8f50e273721757e'/>
<id>urn:sha1:792eac1843196708e6f72e73b8f50e273721757e</id>
<content type='text'>
The hwmon core registers the hwmon device before adding sensors to the
thermal core. If that fails, the hwmon device is released and an error
is returned to the caller. From the code flow, it appears to be necessary
to free struct hwmon_device *, allocated with kzalloc(), in that
situation. This is incorrect, since the data structure will be freed
automatically in hwmon_dev_release() when device_unregister() is called.
This used to result in a double free, which was found and fixed with
commit 74e3512731bd ("hwmon: (core) Fix double-free in
__hwmon_device_register()"). This is, however, not obvious; any reader
may erroneously conclude that the data structure is not freed.

Add comment explaining why kfree() is not necessary in this situation.

Reported-by: Eduardo Valentin &lt;eduval@amazon.com&gt;
Cc: Eduardo Valentin &lt;eduval@amazon.com&gt;
Signed-off-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
</content>
</entry>
<entry>
<title>Merge tag 'spdx-5.2-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core</title>
<updated>2019-06-08T19:52:42Z</updated>
<author>
<name>Linus Torvalds</name>
</author>
<published>2019-06-08T19:52:42Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=9331b6740f86163908de69f4008e434fe0c27691'/>
<id>urn:sha1:9331b6740f86163908de69f4008e434fe0c27691</id>
<content type='text'>
Pull yet more SPDX updates from Greg KH:
 "Another round of SPDX header file fixes for 5.2-rc4

  These are all more "GPL-2.0-or-later" or "GPL-2.0-only" tags being
  added, based on the text in the files. We are slowly chipping away at
  the 700+ different ways people tried to write the license text. All of
  these were reviewed on the spdx mailing list by a number of different
  people.

  We now have over 60% of the kernel files covered with SPDX tags:
	$ ./scripts/spdxcheck.py -v 2&gt;&amp;1 | grep Files
	Files checked:            64533
	Files with SPDX:          40392
	Files with errors:            0

  I think the majority of the "easy" fixups are now done, it's now the
  start of the longer-tail of crazy variants to wade through"

* tag 'spdx-5.2-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (159 commits)
  treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 450
  treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 449
  treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 448
  treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 446
  treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 445
  treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 444
  treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 443
  treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 442
  treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 441
  treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 440
  treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 438
  treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 437
  treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 436
  treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 435
  treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 434
  treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 433
  treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 432
  treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 431
  treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 430
  treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 429
  ...
</content>
</entry>
<entry>
<title>hwmon: (core) add thermal sensors only if dev-&gt;of_node is present</title>
<updated>2019-06-06T01:36:27Z</updated>
<author>
<name>Eduardo Valentin</name>
</author>
<published>2019-05-30T02:56:04Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c41dd48e21fae3e55b3670ccf2eb562fc1f6a67d'/>
<id>urn:sha1:c41dd48e21fae3e55b3670ccf2eb562fc1f6a67d</id>
<content type='text'>
Drivers may register to hwmon and request for also registering
with the thermal subsystem (HWMON_C_REGISTER_TZ). However,
some of these driver, e.g. marvell phy, may be probed from
Device Tree or being dynamically allocated, and in the later
case, it will not have a dev-&gt;of_node entry.

Registering with hwmon without the dev-&gt;of_node may result in
different outcomes depending on the device tree, which may
be a bit misleading. If the device tree blob has no 'thermal-zones'
node, the *hwmon_device_register*() family functions are going
to gracefully succeed, because of-thermal,
*thermal_zone_of_sensor_register() return -ENODEV in this case,
and the hwmon error path handles this error code as success to
cover for the case where CONFIG_THERMAL_OF is not set.
However, if the device tree blob has the 'thermal-zones'
entry, the *hwmon_device_register*() will always fail on callers
with no dev-&gt;of_node, propagating -EINVAL.

If dev-&gt;of_node is not present, calling of-thermal does not
make sense. For this reason, this patch checks first if the
device has a of_node before going over the process of registering
with the thermal subsystem of-thermal interface. And in this case,
when a caller of *hwmon_device_register*() with HWMON_C_REGISTER_TZ
and no dev-&gt;of_node will still register with hwmon, but not with
the thermal subsystem. If all the hwmon part bits are in place,
the registration will succeed.

Fixes: d560168b5d0f ("hwmon: (core) New hwmon registration API")
Cc: Jean Delvare &lt;jdelvare@suse.com&gt;
Cc: Guenter Roeck &lt;linux@roeck-us.net&gt;
Cc: linux-hwmon@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Eduardo Valentin &lt;eduval@amazon.com&gt;
Signed-off-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
</content>
</entry>
<entry>
<title>treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 441</title>
<updated>2019-06-05T15:37:17Z</updated>
<author>
<name>Thomas Gleixner</name>
</author>
<published>2019-06-01T08:08:55Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b886d83c5b621abc84ff9616f14c529be3f6b147'/>
<id>urn:sha1:b886d83c5b621abc84ff9616f14c529be3f6b147</id>
<content type='text'>
Based on 1 normalized pattern(s):

  this program is free software you can redistribute it and or modify
  it under the terms of the gnu general public license as published by
  the free software foundation version 2 of the license

extracted by the scancode license scanner the SPDX license identifier

  GPL-2.0-only

has been chosen to replace the boilerplate/reference in 315 file(s).

Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Reviewed-by: Allison Randal &lt;allison@lohutok.net&gt;
Reviewed-by: Armijn Hemel &lt;armijn@tjaldur.nl&gt;
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190531190115.503150771@linutronix.de
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux</title>
<updated>2019-05-16T23:16:18Z</updated>
<author>
<name>Linus Torvalds</name>
</author>
<published>2019-05-16T23:16:18Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=2c45e7fbc962be1b03f2c2af817a76f5ba810af2'/>
<id>urn:sha1:2c45e7fbc962be1b03f2c2af817a76f5ba810af2</id>
<content type='text'>
Pull thermal management updates from Zhang Rui:

 - Remove the 'module' Kconfig option for thermal subsystem framework
   because the thermal framework are required to be ready as early as
   possible to avoid overheat at boot time (Daniel Lezcano)

 - Fix a bug that thermal framework pokes disabled thermal zones upon
   resume (Wei Wang)

  - A couple of cleanups and trivial fixes on int340x thermal drivers
    (Srinivas Pandruvada, Zhang Rui, Sumeet Pawnikar)

* 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux:
  drivers: thermal: processor_thermal: Downgrade error message
  mlxsw: Remove obsolete dependency on THERMAL=m
  hwmon/drivers/core: Simplify complex dependency
  thermal/drivers/core: Fix typo in the option name
  thermal/drivers/core: Remove depends on THERMAL in Kconfig
  thermal/drivers/core: Remove module unload code
  thermal/drivers/core: Remove the module Kconfig's option
  thermal: core: skip update disabled thermal zones after suspend
  thermal: make device_register's type argument const
  thermal: intel: int340x: processor_thermal_device: simplify to get driver data
  thermal/int3403_thermal: favor _TMP instead of PTYP
</content>
</entry>
<entry>
<title>hwmon/drivers/core: Simplify complex dependency</title>
<updated>2019-05-06T12:35:24Z</updated>
<author>
<name>Daniel Lezcano</name>
</author>
<published>2019-04-02T16:12:50Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f37353320ee9905ef7aaba4c67eae85496bee950'/>
<id>urn:sha1:f37353320ee9905ef7aaba4c67eae85496bee950</id>
<content type='text'>
As the thermal framework does not longer compile as a module, we can
simplify this condition below:

 if IS_REACHABLE(CONFIG_THERMAL) &amp;&amp; defined(CONFIG_THERMAL_OF) &amp;&amp; \
       (!defined(CONFIG_THERMAL_HWMON) || \
        !(defined(MODULE) &amp;&amp; IS_MODULE(CONFIG_THERMAL)))

 if IS_REACHABLE(CONFIG_THERMAL) &amp;&amp; defined(CONFIG_THERMAL_OF) &amp;&amp; \
       (!defined(CONFIG_THERMAL_HWMON) || \
        !(defined(MODULE) &amp;&amp; 0))

=&gt; (whatever &amp;&amp; 0) = 0

 if IS_REACHABLE(CONFIG_THERMAL) &amp;&amp; defined(CONFIG_THERMAL_OF) &amp;&amp; \
       (!defined(CONFIG_THERMAL_HWMON) || !(0))

 if IS_REACHABLE(CONFIG_THERMAL) &amp;&amp; defined(CONFIG_THERMAL_OF) &amp;&amp; \
       (!defined(CONFIG_THERMAL_HWMON) || 1)

=&gt; (whatever || 1) = 1

 if IS_REACHABLE(CONFIG_THERMAL) &amp;&amp; defined(CONFIG_THERMAL_OF) &amp;&amp; \
       (1)

=&gt; (whatever &amp;&amp; 1) = whatever

 if IS_REACHABLE(CONFIG_THERMAL) &amp;&amp; defined(CONFIG_THERMAL_OF)

CONFIG_THERMAL can not be a module anymore, then:

 if defined(CONFIG_THERMAL) &amp;&amp; defined(CONFIG_THERMAL_OF)

And CONFIG_THERMAL_OF already depends on CONFIG_THERMAL, so:

 if defined(CONFIG_THERMAL_OF)

Thus,

 ifdef CONFIG_THERMAL_OF

Signed-off-by: Daniel Lezcano &lt;daniel.lezcano@linaro.org&gt;
Acked-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
Signed-off-by: Zhang Rui &lt;rui.zhang@intel.com&gt;
</content>
</entry>
</feed>
