<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/leds, branch v4.4.235</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v4.4.235</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v4.4.235'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2020-08-21T08:53:00+00:00</updated>
<entry>
<title>leds: lm355x: avoid enum conversion warning</title>
<updated>2020-08-21T08:53:00+00:00</updated>
<author>
<name>Arnd Bergmann</name>
<email>arnd@arndb.de</email>
</author>
<published>2020-05-05T14:19:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=0cf20343e6c4d972e1f1746ffeeb795150a3c168'/>
<id>urn:sha1:0cf20343e6c4d972e1f1746ffeeb795150a3c168</id>
<content type='text'>
[ Upstream commit 985b1f596f9ed56f42b8c2280005f943e1434c06 ]

clang points out that doing arithmetic between diffent enums is usually
a mistake:

drivers/leds/leds-lm355x.c:167:28: warning: bitwise operation between different enumeration types ('enum lm355x_tx2' and 'enum lm355x_ntc') [-Wenum-enum-conversion]
                reg_val = pdata-&gt;pin_tx2 | pdata-&gt;ntc_pin;
                          ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~
drivers/leds/leds-lm355x.c:178:28: warning: bitwise operation between different enumeration types ('enum lm355x_tx2' and 'enum lm355x_ntc') [-Wenum-enum-conversion]
                reg_val = pdata-&gt;pin_tx2 | pdata-&gt;ntc_pin | pdata-&gt;pass_mode;
                          ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~

In this driver, it is intentional, so add a cast to hide the false-positive
warning. It appears to be the only instance of this warning at the moment.

Fixes: b98d13c72592 ("leds: Add new LED driver for lm355x chips")
Signed-off-by: Arnd Bergmann &lt;arnd@arndb.de&gt;
Signed-off-by: Pavel Machek &lt;pavel@ucw.cz&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>leds: leds-lp5562 allow firmware files up to the maximum length</title>
<updated>2019-10-05T10:27:44+00:00</updated>
<author>
<name>Nick Stoughton</name>
<email>nstoughton@logitech.com</email>
</author>
<published>2019-07-17T21:56:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=28b772b6890184b5de673230be6991402f6d05c4'/>
<id>urn:sha1:28b772b6890184b5de673230be6991402f6d05c4</id>
<content type='text'>
[ Upstream commit ed2abfebb041473092b41527903f93390d38afa7 ]

Firmware files are in ASCII, using 2 hex characters per byte. The
maximum length of a firmware string is therefore

16 (commands) * 2 (bytes per command) * 2 (characters per byte) = 64

Fixes: ff45262a85db ("leds: add new LP5562 LED driver")
Signed-off-by: Nick Stoughton &lt;nstoughton@logitech.com&gt;
Acked-by: Pavel Machek &lt;pavel@ucw.cz&gt;
Signed-off-by: Jacek Anaszewski &lt;jacek.anaszewski@gmail.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>leds: lp55xx: fix null deref on firmware load failure</title>
<updated>2019-04-27T07:33:51+00:00</updated>
<author>
<name>Michal Kazior</name>
<email>michal@plume.com</email>
</author>
<published>2019-02-11T09:29:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=f1289edae5148d31477dcbac53010570b291879b'/>
<id>urn:sha1:f1289edae5148d31477dcbac53010570b291879b</id>
<content type='text'>
[ Upstream commit 5ddb0869bfc1bca6cfc592c74c64a026f936638c ]

I've stumbled upon a kernel crash and the logs
pointed me towards the lp5562 driver:

&gt; &lt;4&gt;[306013.841294] lp5562 0-0030: Direct firmware load for lp5562 failed with error -2
&gt; &lt;4&gt;[306013.894990] lp5562 0-0030: Falling back to user helper
&gt; ...
&gt; &lt;3&gt;[306073.924886] lp5562 0-0030: firmware request failed
&gt; &lt;1&gt;[306073.939456] Unable to handle kernel NULL pointer dereference at virtual address 00000000
&gt; &lt;4&gt;[306074.251011] PC is at _raw_spin_lock+0x1c/0x58
&gt; &lt;4&gt;[306074.255539] LR is at release_firmware+0x6c/0x138
&gt; ...

After taking a look I noticed firmware_release()
could be called with either NULL or a dangling
pointer.

Fixes: 10c06d178df11 ("leds-lp55xx: support firmware interface")
Signed-off-by: Michal Kazior &lt;michal@plume.com&gt;
Signed-off-by: Jacek Anaszewski &lt;jacek.anaszewski@gmail.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>leds: lp5523: fix a missing check of return value of lp55xx_read</title>
<updated>2019-03-23T07:44:17+00:00</updated>
<author>
<name>Kangjie Lu</name>
<email>kjlu@umn.edu</email>
</author>
<published>2018-12-26T04:18:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=65aac32fee8007170c5ce738837046bde5f2b12d'/>
<id>urn:sha1:65aac32fee8007170c5ce738837046bde5f2b12d</id>
<content type='text'>
[ Upstream commit 248b57015f35c94d4eae2fdd8c6febf5cd703900 ]

When lp55xx_read() fails, "status" is an uninitialized variable and thus
may contain random value; using it leads to undefined behaviors.

The fix inserts a check for the return value of lp55xx_read: if it
fails, returns with its error code.

Signed-off-by: Kangjie Lu &lt;kjlu@umn.edu&gt;
Signed-off-by: Jacek Anaszewski &lt;jacek.anaszewski@gmail.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>leds: leds-gpio: Fix return value check in create_gpio_led()</title>
<updated>2018-12-13T08:21:31+00:00</updated>
<author>
<name>Wei Yongjun</name>
<email>yongjun_wei@trendmicro.com.cn</email>
</author>
<published>2016-02-06T14:37:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=0c4da5d2b0d53b79ebe8e3b3f17edfe6ec146737'/>
<id>urn:sha1:0c4da5d2b0d53b79ebe8e3b3f17edfe6ec146737</id>
<content type='text'>
commit 2d88a331e48095cf60ad9bdf3177bd401bf99727 upstream.

In case of error, the function gpio_to_desc() returns NULL
pointer not ERR_PTR(). The IS_ERR() test in the return value
check should be replaced with NULL test.

Signed-off-by: Wei Yongjun &lt;yongjun_wei@trendmicro.com.cn&gt;
Signed-off-by: Jacek Anaszewski &lt;j.anaszewski@samsung.com&gt;
Signed-off-by: Krzysztof Kozlowski &lt;krzk@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>leds: turn off the LED and wait for completion on unregistering LED class device</title>
<updated>2018-12-13T08:21:31+00:00</updated>
<author>
<name>Milo Kim</name>
<email>milo.kim@ti.com</email>
</author>
<published>2015-11-20T08:03:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=5e946ed3c55c43441440d478c0b1b5086d6e8999'/>
<id>urn:sha1:5e946ed3c55c43441440d478c0b1b5086d6e8999</id>
<content type='text'>
commit d1aa577f5e191d77d3ad62da93729b5af9532bb4 upstream.

Workqueue, 'set_brightness_work' is used for scheduling brightness control.
This workqueue is canceled when the LED class device is unregistered.
Currently, LED subsystem handles like below.

  cancel_work_sync(&amp;led_cdev-&gt;set_brightness_work)
  led_set_brightness(led_cdev, LED_OFF)

However, this could be a problem.
Workqueue is going to be canceled but LED device needs to be off.
The worst case is null pointer access due to scheduling a workqueue.

LED module is loaded.
  LED driver private data is allocated by using devm_zalloc().

LED module is unloaded.
  led_classdev_unregister() is called.
    cancel_work_sync()
      led_set_brightness(led_cdev, LED_OFF)
        schedule_work() if LED driver uses brightness_set_blocking()
        In the meantime, driver private data will be freed.

        ..scheduling..

        brightness_set_blocking() callback is invoked.
          For the brightness control, LED driver tries to access private
          data but resource is removed!

To avoid this problem, LED subsystem should turn off the brightness first
and wait for completion.

  led_set_brightness(led_cdev, LED_OFF)
  flush_work(&amp;led_cdev-&gt;set_brightness_work)

It guarantees that LED driver turns off the brightness prior to
resource management.

Cc: linux-leds@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Milo Kim &lt;milo.kim@ti.com&gt;
Signed-off-by: Jacek Anaszewski &lt;j.anaszewski@samsung.com&gt;
Signed-off-by: Krzysztof Kozlowski &lt;krzk@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>leds: call led_pwm_set() in leds-pwm to enforce default LED_OFF</title>
<updated>2018-12-13T08:21:30+00:00</updated>
<author>
<name>Markus Hofstaetter</name>
<email>markus.hofstaetter@ait.ac.at</email>
</author>
<published>2015-11-11T11:40:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=c5cc3e038d083515e6112707f7ffcdf0e5aa8497'/>
<id>urn:sha1:c5cc3e038d083515e6112707f7ffcdf0e5aa8497</id>
<content type='text'>
commit f16703360da7731a057df2ffa902306819c22398 upstream.

Some PWMs are disabled by default or the default pin setting
does not match the LED_OFF state (e.g., active-low leds).
Hence, the driver may end up reporting 0 brightness, but
the leds are actually on using full brightness, because
it never enforces its default configuration.
So enforce it by calling led_pwm_set() after successfully
registering the device.

Tested on a Phytec phyFLEX i.MX6Q board based on kernel
v3.19.5.

Signed-off-by: Markus Hofstaetter &lt;markus.hofstaetter@ait.ac.at&gt;
Tested-by: Markus Hofstaetter &lt;markus.hofstaetter@ait.ac.at&gt;
Signed-off-by: Jacek Anaszewski &lt;j.anaszewski@samsung.com&gt;
Signed-off-by: Krzysztof Kozlowski &lt;krzk@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>leds: pca955x: Correct I2C Functionality</title>
<updated>2018-04-13T17:50:09+00:00</updated>
<author>
<name>Tin Huynh</name>
<email>tnhuynh@apm.com</email>
</author>
<published>2017-05-22T09:19:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=a7147749b69ffe8b87f53104f770c796d437780b'/>
<id>urn:sha1:a7147749b69ffe8b87f53104f770c796d437780b</id>
<content type='text'>
[ Upstream commit aace34c0bb8ea3c8bdcec865b6a4be4db0a68e33 ]

The driver checks an incorrect flag of functionality of adapter.
When a driver requires i2c_smbus_read_byte_data and
i2c_smbus_write_byte_data, it should check I2C_FUNC_SMBUS_BYTE_DATA
instead I2C_FUNC_I2C.
This patch fixes the problem.

Signed-off-by: Tin Huynh &lt;tnhuynh@apm.com&gt;
Signed-off-by: Jacek Anaszewski &lt;jacek.anaszewski@gmail.com&gt;
Signed-off-by: Sasha Levin &lt;alexander.levin@microsoft.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>Revert "led: core: Fix brightness setting when setting delay_off=0"</title>
<updated>2018-03-11T15:19:45+00:00</updated>
<author>
<name>Ben Hutchings</name>
<email>ben.hutchings@codethink.co.uk</email>
</author>
<published>2018-03-08T15:59:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=3f3437fbb2d8f780e84f507282d03facb4ccf248'/>
<id>urn:sha1:3f3437fbb2d8f780e84f507282d03facb4ccf248</id>
<content type='text'>
This reverts commit 20ac8f72514b3af8b62c520d55656ded865eff00, which
was commit 2b83ff96f51d0b039c4561b9f95c824d7bddb85c upstream.
The bug that it should fix was only introduced in Linux 4.7, and
in 4.4 it causes a regression.

Reported-by: Jacek Anaszewski &lt;jacek.anaszewski@gmail.com&gt;
Cc: Matthieu CASTET &lt;matthieu.castet@parrot.com&gt;
Signed-off-by: Ben Hutchings &lt;ben.hutchings@codethink.co.uk&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>leds: do not overflow sysfs buffer in led_trigger_show</title>
<updated>2018-03-11T15:19:45+00:00</updated>
<author>
<name>Nathan Sullivan</name>
<email>nathan.sullivan@ni.com</email>
</author>
<published>2016-08-15T22:20:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=dff485e36287be123a844dc9164ba0417cd34552'/>
<id>urn:sha1:dff485e36287be123a844dc9164ba0417cd34552</id>
<content type='text'>
commit 3b9b95363c45365d606ad4bbba16acca75fdf6d3 upstream.

Per the documentation, use scnprintf instead of sprintf to ensure there
is never more than PAGE_SIZE bytes of trigger names put into the
buffer.

Signed-off-by: Nathan Sullivan &lt;nathan.sullivan@ni.com&gt;
Signed-off-by: Zach Brown &lt;zach.brown@ni.com&gt;
Signed-off-by: Jacek Anaszewski &lt;j.anaszewski@samsung.com&gt;
Cc: Willy Tarreau &lt;w@1wt.eu&gt;
Cc: Vlastimil Babka &lt;vbabka@suse.cz&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
</feed>
