linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Fabio Estevam <fabio.estevam@freescale.com>
To: dmitry.torokhov@gmail.com
Cc: linux-input@vger.kernel.org, festevam@gmail.com,
	Fabio Estevam <fabio.estevam@freescale.com>
Subject: [PATCH] Input: gpio_keys - fix warning regarding uninitialized  'button' variable
Date: Tue, 9 Dec 2014 12:44:12 -0200	[thread overview]
Message-ID: <1418136252-14365-1-git-send-email-fabio.estevam@freescale.com> (raw)

Commit af906faabcf91eb1 ("Input: gpio_keys - fix warning regarding uninitialized
'irq' variable") introduced the following build warning:

drivers/input/keyboard/gpio_keys.c:625:16: warning: 'button' may be used uninitialized in this function [-Wmaybe-uninitialized]

Move the 'button' initialization to a proper location to avoid such warning.

Reported-by: Olof's autobuilder <build@lixom.net>
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
 drivers/input/keyboard/gpio_keys.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
index fb8256f..28ac922 100644
--- a/drivers/input/keyboard/gpio_keys.c
+++ b/drivers/input/keyboard/gpio_keys.c
@@ -621,6 +621,8 @@ gpio_keys_get_devtree_pdata(struct device *dev)
 		int gpio = -1;
 		enum of_gpio_flags flags;
 
+		button = &pdata->buttons[i++];
+
 		if (!of_find_property(pp, "gpios", NULL)) {
 			button->irq = irq_of_parse_and_map(pp, 0);
 			if (button->irq == 0) {
@@ -640,8 +642,6 @@ gpio_keys_get_devtree_pdata(struct device *dev)
 			}
 		}
 
-		button = &pdata->buttons[i++];
-
 		button->gpio = gpio;
 		button->active_low = flags & OF_GPIO_ACTIVE_LOW;
 
-- 
1.9.1


             reply	other threads:[~2014-12-09 14:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-09 14:44 Fabio Estevam [this message]
2014-12-13 19:00 ` [PATCH] Input: gpio_keys - fix warning regarding uninitialized 'button' variable Dmitry Torokhov
2014-12-13 19:05   ` Dmitry Torokhov

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=1418136252-14365-1-git-send-email-fabio.estevam@freescale.com \
    --to=fabio.estevam@freescale.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=festevam@gmail.com \
    --cc=linux-input@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).