gpio: pca954x: fix undefined error code from remove
authorArnd Bergmann <arnd@arndb.de>
Fri, 26 Aug 2016 15:25:42 +0000 (17:25 +0200)
committerLinus Walleij <linus.walleij@linaro.org>
Wed, 7 Sep 2016 14:14:42 +0000 (16:14 +0200)
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")
Acked-by: Phil Reid <preid@electromag.com.au>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpio-pca953x.c

index cbe2824461ebe8cf84eb585b6af482bccbbe0a66..b9d31d737dbf8b118fc581327a5e9c2fb2eac15c 100644 (file)
@@ -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);