linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] gpio: brcmstb: missing error code
@ 2016-04-15 14:45 Dan Carpenter
  2016-04-15 22:04 ` Florian Fainelli
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2016-04-15 14:45 UTC (permalink / raw)
  To: Gregory Fong
  Cc: Linus Walleij, Alexandre Courbot, Brian Norris, Florian Fainelli,
	bcm-kernel-feedback-list, linux-gpio, kernel-janitors

We should set the error code before returning here.  Otherwise "err"
could be uninitialized or zero.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/gpio/gpio-brcmstb.c b/drivers/gpio/gpio-brcmstb.c
index 42d51c5..e648914 100644
--- a/drivers/gpio/gpio-brcmstb.c
+++ b/drivers/gpio/gpio-brcmstb.c
@@ -461,6 +461,7 @@ static int brcmstb_gpio_probe(struct platform_device *pdev)
 		bank->id = num_banks;
 		if (bank_width <= 0 || bank_width > MAX_GPIO_PER_BANK) {
 			dev_err(dev, "Invalid bank width %d\n", bank_width);
+			err = -EINVAL;
 			goto fail;
 		} else {
 			bank->width = bank_width;

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [patch] gpio: brcmstb: missing error code
  2016-04-15 14:45 [patch] gpio: brcmstb: missing error code Dan Carpenter
@ 2016-04-15 22:04 ` Florian Fainelli
  2016-04-15 22:25   ` Dan Carpenter
  0 siblings, 1 reply; 3+ messages in thread
From: Florian Fainelli @ 2016-04-15 22:04 UTC (permalink / raw)
  To: Dan Carpenter, Gregory Fong
  Cc: Linus Walleij, Alexandre Courbot, Brian Norris, Florian Fainelli,
	bcm-kernel-feedback-list, linux-gpio, kernel-janitors

On 15/04/16 07:45, Dan Carpenter wrote:
> We should set the error code before returning here.  Otherwise "err"
> could be uninitialized or zero.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Axel just sent an identical patch which Linus picked already:

http://www.spinics.net/lists/linux-gpio/msg13728.html

Thanks Dan!
-- 
Florian

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch] gpio: brcmstb: missing error code
  2016-04-15 22:04 ` Florian Fainelli
@ 2016-04-15 22:25   ` Dan Carpenter
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2016-04-15 22:25 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: Gregory Fong, Linus Walleij, Alexandre Courbot, Brian Norris,
	bcm-kernel-feedback-list, linux-gpio, kernel-janitors

On Fri, Apr 15, 2016 at 03:04:20PM -0700, Florian Fainelli wrote:
> On 15/04/16 07:45, Dan Carpenter wrote:
> > We should set the error code before returning here.  Otherwise "err"
> > could be uninitialized or zero.
> > 
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> Axel just sent an identical patch which Linus picked already:
> 
> http://www.spinics.net/lists/linux-gpio/msg13728.html

Heh.  Weird timing.  That bug has been there for 11 months...

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-04-15 22:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-15 14:45 [patch] gpio: brcmstb: missing error code Dan Carpenter
2016-04-15 22:04 ` Florian Fainelli
2016-04-15 22:25   ` Dan Carpenter

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).