Commit e0d42298 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Jacek Anaszewski

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: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarJacek Anaszewski <jacek.anaszewski@gmail.com>
parent a72d3b5d
...@@ -549,8 +549,12 @@ static int blinkm_detect(struct i2c_client *client, struct i2c_board_info *info) ...@@ -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) */ /* make sure the blinkM is balanced (read/writes) */
while (count > 0) { while (count > 0) {
ret = blinkm_write(client, BLM_GET_ADDR, NULL); ret = blinkm_write(client, BLM_GET_ADDR, NULL);
if (ret)
return ret;
usleep_range(5000, 10000); usleep_range(5000, 10000);
ret = blinkm_read(client, BLM_GET_ADDR, tmpargs); ret = blinkm_read(client, BLM_GET_ADDR, tmpargs);
if (ret)
return ret;
usleep_range(5000, 10000); usleep_range(5000, 10000);
if (tmpargs[0] == 0x09) if (tmpargs[0] == 0x09)
count = 0; count = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment