Message ID | 20160826152546.604384-2-arnd@arndb.de |
---|---|
State | New |
Headers | show |
On 26/08/2016 23:25, Arnd Bergmann wrote: > The recent addition of the regulator support has led to the pca953x_remove > function returning uninitialized data when no platform data pointer is > provided, as gcc warns when using -Wmaybe-uninitialized: > > drivers/gpio/gpio-pca953x.c: In function 'pca953x_remove': > drivers/gpio/gpio-pca953x.c:860:9: error: 'ret' may be used uninitialized in this function [-Werror=maybe-uninitialized] > > This restores the previous behavior, returning 0 on success. > > Signed-off-by: Arnd Bergmann <arnd@arndb.de> > Fixes: e23efa311110 ("gpio: pca954x: Add vcc regulator and enable it") > Cc: Phil Reid <preid@electromag.com.au> > --- > Cc: Linus Walleij <linus.walleij@linaro.org> > Cc: Alexandre Courbot <gnurou@gmail.com> > Cc: linux-gpio@vger.kernel.org > > drivers/gpio/gpio-pca953x.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c > index cbe2824461eb..b9d31d737dbf 100644 > --- a/drivers/gpio/gpio-pca953x.c > +++ b/drivers/gpio/gpio-pca953x.c > @@ -853,6 +853,8 @@ static int pca953x_remove(struct i2c_client *client) > if (ret < 0) > dev_err(&client->dev, "%s failed, %d\n", > "teardown", ret); > + } else { > + ret = 0; > } > > regulator_disable(chip->regulator); > Ahh, commit 8c7a92dad1621f38d1ff4fe9eaac898d6f33a0a3 gpio: pca953x: remove redundant assignments removed the 'redundant' initialisation of ret in this function. Looks like I did not have this commit in my tree when I submitted did the regulator patch. Sorry about that. Alternative to the 'else' is to add init at definition. Acked-by: Phil Reid <preid@electromag.com.au>
On Fri, Aug 26, 2016 at 5:25 PM, Arnd Bergmann <arnd@arndb.de> wrote: > The recent addition of the regulator support has led to the pca953x_remove > function returning uninitialized data when no platform data pointer is > provided, as gcc warns when using -Wmaybe-uninitialized: > > drivers/gpio/gpio-pca953x.c: In function 'pca953x_remove': > drivers/gpio/gpio-pca953x.c:860:9: error: 'ret' may be used uninitialized in this function [-Werror=maybe-uninitialized] > > This restores the previous behavior, returning 0 on success. > > Signed-off-by: Arnd Bergmann <arnd@arndb.de> > Fixes: e23efa311110 ("gpio: pca954x: Add vcc regulator and enable it") > Cc: Phil Reid <preid@electromag.com.au> > --- > Cc: Linus Walleij <linus.walleij@linaro.org> > Cc: Alexandre Courbot <gnurou@gmail.com> > Cc: linux-gpio@vger.kernel.org Patch applied with Phil's ACK. Yours, Linus Walleij -- 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-pca953x.c b/drivers/gpio/gpio-pca953x.c index cbe2824461eb..b9d31d737dbf 100644 --- a/drivers/gpio/gpio-pca953x.c +++ b/drivers/gpio/gpio-pca953x.c @@ -853,6 +853,8 @@ static int pca953x_remove(struct i2c_client *client) if (ret < 0) dev_err(&client->dev, "%s failed, %d\n", "teardown", ret); + } else { + ret = 0; } regulator_disable(chip->regulator);
The recent addition of the regulator support has led to the pca953x_remove function returning uninitialized data when no platform data pointer is provided, as gcc warns when using -Wmaybe-uninitialized: drivers/gpio/gpio-pca953x.c: In function 'pca953x_remove': drivers/gpio/gpio-pca953x.c:860:9: error: 'ret' may be used uninitialized in this function [-Werror=maybe-uninitialized] This restores the previous behavior, returning 0 on success. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Fixes: e23efa311110 ("gpio: pca954x: Add vcc regulator and enable it") Cc: Phil Reid <preid@electromag.com.au> --- Cc: Linus Walleij <linus.walleij@linaro.org> Cc: Alexandre Courbot <gnurou@gmail.com> Cc: linux-gpio@vger.kernel.org drivers/gpio/gpio-pca953x.c | 2 ++ 1 file changed, 2 insertions(+)