From: Colin King <colin.king@canonical.com>
To: Linus Walleij <linus.walleij@linaro.org>,
Alexandre Courbot <gnurou@gmail.com>,
linux-gpio@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] gpio: pca953x: initialize ret to zero to avoid returning garbage
Date: Fri, 9 Sep 2016 09:31:54 +0100 [thread overview]
Message-ID: <20160909083154.26442-1-colin.king@canonical.com> (raw)
From: Colin Ian King <colin.king@canonical.com>
ret is not initialized so it contains garbage. Ensure garbage
is not returned in the case that pdata && pdata->teardown is false
by initializing ret to 0.
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/gpio/gpio-pca953x.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
index cbe2824..52f3d5c 100644
--- a/drivers/gpio/gpio-pca953x.c
+++ b/drivers/gpio/gpio-pca953x.c
@@ -845,7 +845,7 @@ static int pca953x_remove(struct i2c_client *client)
{
struct pca953x_platform_data *pdata = dev_get_platdata(&client->dev);
struct pca953x_chip *chip = i2c_get_clientdata(client);
- int ret;
+ int ret = 0;
if (pdata && pdata->teardown) {
ret = pdata->teardown(client, chip->gpio_chip.base,
--
2.9.3
next reply other threads:[~2016-09-09 8:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-09 8:31 Colin King [this message]
2016-09-12 13:40 ` [PATCH] gpio: pca953x: initialize ret to zero to avoid returning garbage Linus Walleij
2016-09-13 4:04 ` Phil Reid
2016-09-13 11:49 ` Linus Walleij
2016-09-13 12:31 ` Arnd Bergmann
2016-09-13 12:46 ` Linus Walleij
2016-09-13 12:45 ` Colin Ian King
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160909083154.26442-1-colin.king@canonical.com \
--to=colin.king@canonical.com \
--cc=gnurou@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.