public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Wolfram Sang <wsa@the-dreams.de>
To: "George G. Davis" <ggdavisiv@gmail.com>
Cc: "open list:I2C SUBSYSTEM" <linux-i2c@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>,
	"George G. Davis" <george_davis@mentor.com>
Subject: Re: [PATCH] i2c: core: squelch error: uninitialized symbol 'ret'
Date: Fri, 5 Oct 2018 18:28:41 +0200	[thread overview]
Message-ID: <20181005162841.wy4uyespwcvffkpc@ninjato> (raw)
In-Reply-To: <20181005161826.2455-1-george_davis@mentor.com>

[-- Attachment #1: Type: text/plain, Size: 1350 bytes --]

On Fri, Oct 05, 2018 at 12:18:25PM -0400, George G. Davis wrote:
> The following smatch error was introduced by commit 7ca5f6be7900 ("i2c:
> recovery: add get_bus_free callback"):
> 
> drivers/i2c/i2c-core-base.c:228 i2c_generic_scl_recovery() error: uninitialized symbol 'ret'.
> 
> Analysis of the code appears to show that the smatch error is a false
> positive since 'ret' will in fact be initialized after exiting the
> 'while()' loop.
> 
> Squelch the smatch error since it is a false positive.

What about fixing smatch?

> 
> Fixes: 7ca5f6be7900 ("i2c: recovery: add get_bus_free callback")
> Signed-off-by: George G. Davis <george_davis@mentor.com>
> ---
>  drivers/i2c/i2c-core-base.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c
> index 9ee9a15e7134..7b25ecb6b616 100644
> --- a/drivers/i2c/i2c-core-base.c
> +++ b/drivers/i2c/i2c-core-base.c
> @@ -185,7 +185,7 @@ static int i2c_generic_bus_free(struct i2c_adapter *adap)
>  int i2c_generic_scl_recovery(struct i2c_adapter *adap)
>  {
>  	struct i2c_bus_recovery_info *bri = adap->bus_recovery_info;
> -	int i = 0, scl = 1, ret;
> +	int i = 0, scl = 1, uninitialized_var(ret);
>  
>  	if (bri->prepare_recovery)
>  		bri->prepare_recovery(adap);
> -- 
> 2.14.4
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2018-10-05 16:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-05 16:18 [PATCH] i2c: core: squelch error: uninitialized symbol 'ret' George G. Davis
2018-10-05 16:28 ` Wolfram Sang [this message]
2018-10-05 16:45   ` George G. Davis
2018-10-05 17:43     ` Wolfram Sang
2018-10-05 20:55       ` George G. Davis

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=20181005162841.wy4uyespwcvffkpc@ninjato \
    --to=wsa@the-dreams.de \
    --cc=george_davis@mentor.com \
    --cc=ggdavisiv@gmail.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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