diff options
author | Fabio Estevam <fabio.estevam@freescale.com> | 2014-12-13 14:02:08 -0500 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2014-12-14 14:51:36 -0500 |
commit | 1d6a01365fd63fbf7c2709a183e2936728c8efad (patch) | |
tree | 6d2160512479c81447c8ee0b968eef2ef6d885a9 /drivers/input | |
parent | 66aee90088da2f5fb73ba97ee8b5f4fda92e2b53 (diff) |
Input: gpio_keys - fix warning regarding uninitialized 'button' variable
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>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input')
-rw-r--r-- | drivers/input/keyboard/gpio_keys.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c index b8b4876ac8d3..f44f05b70ee0 100644 --- a/drivers/input/keyboard/gpio_keys.c +++ b/drivers/input/keyboard/gpio_keys.c | |||
@@ -621,9 +621,12 @@ gpio_keys_get_devtree_pdata(struct device *dev) | |||
621 | int gpio = -1; | 621 | int gpio = -1; |
622 | enum of_gpio_flags flags; | 622 | enum of_gpio_flags flags; |
623 | 623 | ||
624 | button = &pdata->buttons[i++]; | ||
625 | |||
624 | if (!of_find_property(pp, "gpios", NULL)) { | 626 | if (!of_find_property(pp, "gpios", NULL)) { |
625 | button->irq = irq_of_parse_and_map(pp, 0); | 627 | button->irq = irq_of_parse_and_map(pp, 0); |
626 | if (button->irq == 0) { | 628 | if (button->irq == 0) { |
629 | i--; | ||
627 | pdata->nbuttons--; | 630 | pdata->nbuttons--; |
628 | dev_warn(dev, "Found button without gpios or irqs\n"); | 631 | dev_warn(dev, "Found button without gpios or irqs\n"); |
629 | continue; | 632 | continue; |
@@ -640,8 +643,6 @@ gpio_keys_get_devtree_pdata(struct device *dev) | |||
640 | } | 643 | } |
641 | } | 644 | } |
642 | 645 | ||
643 | button = &pdata->buttons[i++]; | ||
644 | |||
645 | button->gpio = gpio; | 646 | button->gpio = gpio; |
646 | button->active_low = flags & OF_GPIO_ACTIVE_LOW; | 647 | button->active_low = flags & OF_GPIO_ACTIVE_LOW; |
647 | 648 | ||