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:05 +0000 (10:08 +0100)
commitcaa27a81df46e5a697ca6731677deeb45100883b
treed3d2393d8cbdba20f3ff2ebc7c1076aeb5392e83
parent733d1915bf571616746f563632015d3bf568bc87
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