Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1470824

[PATCH 1/5] gpio: pca954x: fix undefined error code from remove

From Arnd Bergmann <arnd@arndb.de>
Newsgroups linux.kernel
Subject [PATCH 1/5] gpio: pca954x: fix undefined error code from remove
Date 2016-08-26 17:40 +0200
Message-ID <saroB-ua-15@gated-at.bofh.it> (permalink)
References <sareW-qT-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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);
-- 
2.9.0

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/5] -Wmaybe-uninitialized bug fixes for linux-next Arnd Bergmann <arnd@arndb.de> - 2016-08-26 17:40 +0200
  [PATCH 3/5] rxrpc: fix last_call processing Arnd Bergmann <arnd@arndb.de> - 2016-08-26 17:40 +0200
    Re: [PATCH 3/5] rxrpc: fix last_call processing David Howells <dhowells@redhat.com> - 2016-08-27 09:10 +0200
    Re: [PATCH 3/5] rxrpc: fix last_call processing David Howells <dhowells@redhat.com> - 2016-08-28 10:50 +0200
      Re: [PATCH 3/5] rxrpc: fix last_call processing Arnd Bergmann <arnd@arndb.de> - 2016-08-31 14:00 +0200
        Re: [PATCH 3/5] rxrpc: fix last_call processing David Howells <dhowells@redhat.com> - 2016-08-31 23:00 +0200
  [PATCH 1/5] gpio: pca954x: fix undefined error code from remove Arnd Bergmann <arnd@arndb.de> - 2016-08-26 17:40 +0200
    Re: [PATCH 1/5] gpio: pca954x: fix undefined error code from remove Phil Reid <preid@electromag.com.au> - 2016-08-26 17:50 +0200
    Re: [PATCH 1/5] gpio: pca954x: fix undefined error code from remove Linus Walleij <linus.walleij@linaro.org> - 2016-09-07 16:20 +0200
  [PATCH 4/5] net_sched: fix use of uninitialized ethertype variable in cls_flower Arnd Bergmann <arnd@arndb.de> - 2016-08-26 17:40 +0200
    Re: [PATCH 4/5] net_sched: fix use of uninitialized ethertype  variable in cls_flower David Miller <davem@davemloft.net> - 2016-08-29 06:40 +0200

csiph-web