mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Jan-Simon Moeller <jansimon.moeller@gmx.de>,
	Richard Purdie <rpurdie@rpsys.net>,
	Jacek Anaszewski <jacek.anaszewski@gmail.com>,
	Pavel Machek <pavel@ucw.cz>
Cc: Arnd Bergmann <arnd@arndb.de>,
	Arvind Yadav <arvind.yadav.cs@gmail.com>,
	linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] leds: blinkm: avoid uninitialized data use
Date: Mon,  4 Dec 2017 15:45:29 +0100	[thread overview]
Message-ID: <20171204144538.304782-1-arnd@arndb.de> (raw)

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>
---
 drivers/leds/leds-blinkm.c | 4 ++++
 1 file changed, 4 insertions(+)

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;
-- 
2.9.0

             reply	other threads:[~2017-12-04 14:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-04 14:45 Arnd Bergmann [this message]
2017-12-05 20:30 ` Jacek Anaszewski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171204144538.304782-1-arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=arvind.yadav.cs@gmail.com \
    --cc=jacek.anaszewski@gmail.com \
    --cc=jansimon.moeller@gmx.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --cc=rpurdie@rpsys.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®