leds: lp5523: fix a missing check of return value of lp55xx_read
authorKangjie Lu <kjlu@umn.edu>
Wed, 26 Dec 2018 04:18:23 +0000 (22:18 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 27 Feb 2019 09:08:57 +0000 (10:08 +0100)
commit0761f58c62d70742a20d7a9ee0dfaf8a7eed1e9e
treef48f605fb840b8d10022b0b7748ab66e1d922365
parentddb8d7c9d46041954256eec953d07b15023b5be2
leds: lp5523: fix a missing check of return value of lp55xx_read

[ 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 <kjlu@umn.edu>
Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/leds/leds-lp5523.c