summaryrefslogtreecommitdiffstats
path: root/drivers/leds
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2017-12-04 15:45:29 +0100
committerJacek Anaszewski <jacek.anaszewski@gmail.com>2018-01-08 21:28:10 +0100
commite0d422987936958b41999f62ea64f1dd0102606f (patch)
treeb323f253e42c8d89810973dc0f26b940c5740ae2 /drivers/leds
parenta72d3b5dc68dea113c10bc31404cebe834eb0e49 (diff)
downloadlinux-e0d422987936958b41999f62ea64f1dd0102606f.tar.gz
linux-e0d422987936958b41999f62ea64f1dd0102606f.tar.bz2
linux-e0d422987936958b41999f62ea64f1dd0102606f.zip
leds: blinkm: avoid uninitialized data use
gcc-8 reports missing error handling in blinkm_detect, when blinkm() fails, tmpargs[] is uninitialized: drivers/leds/leds-blinkm.c: In function 'blinkm_detect': drivers/leds/leds-blinkm.c:555:6: error: 'tmpargs' may be used uninitialized in this function [-Werror=maybe-uninitialized] This adds a missing error checks. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Diffstat (limited to 'drivers/leds')
-rw-r--r--drivers/leds/leds-blinkm.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/leds/leds-blinkm.c b/drivers/leds/leds-blinkm.c
index d03ed6b4176b..851c1920b63c 100644
--- a/drivers/leds/leds-blinkm.c
+++ b/drivers/leds/leds-blinkm.c
@@ -549,8 +549,12 @@ static int blinkm_detect(struct i2c_client *client, struct i2c_board_info *info)
/* make sure the blinkM is balanced (read/writes) */
while (count > 0) {
ret = blinkm_write(client, BLM_GET_ADDR, NULL);
+ if (ret)
+ return ret;
usleep_range(5000, 10000);
ret = blinkm_read(client, BLM_GET_ADDR, tmpargs);
+ if (ret)
+ return ret;
usleep_range(5000, 10000);
if (tmpargs[0] == 0x09)
count = 0;