Message ID | 20160415144528.GC8953@mwanda |
---|---|
State | New |
Headers | show |
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!
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 -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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;
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> -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html