* [PATCH] Input: gpio_keys - fix warning regarding uninitialized 'button' variable
@ 2014-12-09 14:44 Fabio Estevam
2014-12-13 19:00 ` Dmitry Torokhov
0 siblings, 1 reply; 3+ messages in thread
From: Fabio Estevam @ 2014-12-09 14:44 UTC (permalink / raw)
To: dmitry.torokhov; +Cc: linux-input, festevam, Fabio Estevam
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Input: gpio_keys - fix warning regarding uninitialized 'button' variable
2014-12-09 14:44 [PATCH] Input: gpio_keys - fix warning regarding uninitialized 'button' variable Fabio Estevam
@ 2014-12-13 19:00 ` Dmitry Torokhov
2014-12-13 19:05 ` Dmitry Torokhov
0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Torokhov @ 2014-12-13 19:00 UTC (permalink / raw)
To: Fabio Estevam; +Cc: linux-input, festevam
On Tue, Dec 09, 2014 at 12:44:12PM -0200, Fabio Estevam wrote:
> 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.
Doh! Why didn't I see the warning at least? Argh!
Applied, thank you.
>
> 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
>
--
Dmitry
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Input: gpio_keys - fix warning regarding uninitialized 'button' variable
2014-12-13 19:00 ` Dmitry Torokhov
@ 2014-12-13 19:05 ` Dmitry Torokhov
0 siblings, 0 replies; 3+ messages in thread
From: Dmitry Torokhov @ 2014-12-13 19:05 UTC (permalink / raw)
To: Fabio Estevam; +Cc: linux-input, festevam
On Sat, Dec 13, 2014 at 11:00:35AM -0800, Dmitry Torokhov wrote:
> On Tue, Dec 09, 2014 at 12:44:12PM -0200, Fabio Estevam wrote:
> > 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.
>
> Doh! Why didn't I see the warning at least? Argh!
>
> Applied, thank you.
>
> >
> > 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) {
By the way, I added
i--;
here to avoid skipping over one element.
> > @@ -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
> >
>
> --
> Dmitry
--
Dmitry
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-12-13 19:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-09 14:44 [PATCH] Input: gpio_keys - fix warning regarding uninitialized 'button' variable Fabio Estevam
2014-12-13 19:00 ` Dmitry Torokhov
2014-12-13 19:05 ` Dmitry Torokhov
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).