Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
fork

Configure Feed

Select the types of activity you want to include in your feed.

leds: lp5523: fix a missing check of return value of lp55xx_read

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>

authored by

Kangjie Lu and committed by
Jacek Anaszewski
248b5701 bfeffd15

+3 -1
+3 -1
drivers/leds/leds-lp5523.c
··· 318 318 319 319 /* Let the programs run for couple of ms and check the engine status */ 320 320 usleep_range(3000, 6000); 321 - lp55xx_read(chip, LP5523_REG_STATUS, &status); 321 + ret = lp55xx_read(chip, LP5523_REG_STATUS, &status); 322 + if (ret) 323 + return ret; 322 324 status &= LP5523_ENG_STATUS_MASK; 323 325 324 326 if (status != LP5523_ENG_STATUS_MASK) {