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

Hi Arnd,

Thanks for the patch.

On 12/04/2017 03:45 PM, Arnd Bergmann wrote:
> 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;
> 

Applied.

-- 
Best regards,
Jacek Anaszewski

      reply	other threads:[~2017-12-05 20:31 UTC|newest]

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

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=5aa46ad0-23d4-15d6-dcbe-58b37de25285@gmail.com \
    --to=jacek.anaszewski@gmail.com \
    --cc=arnd@arndb.de \
    --cc=arvind.yadav.cs@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®