linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Phil Reid <preid@electromag.com.au>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	Colin King <colin.king@canonical.com>,
	Alexandre Courbot <gnurou@gmail.com>,
	"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] gpio: pca953x: initialize ret to zero to avoid returning garbage
Date: Tue, 13 Sep 2016 14:31:29 +0200	[thread overview]
Message-ID: <18457294.js4cyg49EU@wuerfel> (raw)
In-Reply-To: <944b682f-6217-f759-7429-339274cd5894@electromag.com.au>

On Tuesday, September 13, 2016 12:04:00 PM CEST Phil Reid wrote:
> On 12/09/2016 21:40, Linus Walleij wrote:
> > On Fri, Sep 9, 2016 at 10:31 AM, Colin King <colin.king@canonical.com> wrote:
> >
> >> From: Colin Ian King <colin.king@canonical.com>
> >>
> >> ret is not initialized so it contains garbage.  Ensure garbage
> >> is not returned in the case that pdata && pdata->teardown is false
> >> by initializing ret to 0.
> >>
> >> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> >
> > Patch applied.
> G'day Linus,
> 
> 
> I believe this does the same as Arnd Bergmanns patch from 26 Aug.
> [PATCH 1/5] gpio: pca954x: fix undefined error code from remove
> 
> IMO Colin's is the cleaner solution.
> Arnd's could be removed.
> 

Please try to avoid adding initializations in the local variable
declaration, they just hide otherwise useful warnings when
you get a function that actually does something incorrect
in some code paths.

See also https://rusty.ozlabs.org/?p=232

	Arnd

  parent reply	other threads:[~2016-09-13 12:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-09  8:31 [PATCH] gpio: pca953x: initialize ret to zero to avoid returning garbage Colin King
2016-09-12 13:40 ` Linus Walleij
2016-09-13  4:04   ` Phil Reid
2016-09-13 11:49     ` Linus Walleij
2016-09-13 12:31     ` Arnd Bergmann [this message]
2016-09-13 12:46       ` Linus Walleij
2016-09-13 12:45         ` Colin Ian King

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=18457294.js4cyg49EU@wuerfel \
    --to=arnd@arndb.de \
    --cc=colin.king@canonical.com \
    --cc=gnurou@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=preid@electromag.com.au \
    /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;
as well as URLs for NNTP newsgroup(s).