diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2014-12-08 01:42:45 -0500 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2014-12-08 02:07:07 -0500 |
commit | af906faabcf91eb12397d8954f89e289a8b96af5 (patch) | |
tree | 60ae6bb24d6f8a323e68a42d29e91144c22ecdf0 | |
parent | 823a11fdbde32f9efba48093dca74fe81010a265 (diff) |
Input: gpio_keys - fix warning regarding uninitialized 'irq' variable
Commit f2d347ff70be453e ("Input: gpio_keys - add device tree support for
interrupt only keys") caused the following build warning:
drivers/input/keyboard/gpio_keys.c: In function 'gpio_keys_probe':
drivers/input/keyboard/gpio_keys.c:647:15: warning: 'irq' may be used uninitialized in this function [-Wmaybe-uninitialized]
drivers/input/keyboard/gpio_keys.c:622:7: note: 'irq' was declared here
Move button->irq initialization into proper branch and get rid of the
temporary.
Reported-by: Olof's autobuilder <build@lixom.net>
Reported-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
-rw-r--r-- | drivers/input/keyboard/gpio_keys.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c index ce0d9090bbe9..b8b4876ac8d3 100644 --- a/drivers/input/keyboard/gpio_keys.c +++ b/drivers/input/keyboard/gpio_keys.c | |||
@@ -619,12 +619,11 @@ gpio_keys_get_devtree_pdata(struct device *dev) | |||
619 | i = 0; | 619 | i = 0; |
620 | for_each_child_of_node(node, pp) { | 620 | for_each_child_of_node(node, pp) { |
621 | int gpio = -1; | 621 | int gpio = -1; |
622 | int irq; | ||
623 | enum of_gpio_flags flags; | 622 | enum of_gpio_flags flags; |
624 | 623 | ||
625 | if (!of_find_property(pp, "gpios", NULL)) { | 624 | if (!of_find_property(pp, "gpios", NULL)) { |
626 | irq = irq_of_parse_and_map(pp, 0); | 625 | button->irq = irq_of_parse_and_map(pp, 0); |
627 | if (irq == 0) { | 626 | if (button->irq == 0) { |
628 | pdata->nbuttons--; | 627 | pdata->nbuttons--; |
629 | dev_warn(dev, "Found button without gpios or irqs\n"); | 628 | dev_warn(dev, "Found button without gpios or irqs\n"); |
630 | continue; | 629 | continue; |
@@ -644,7 +643,6 @@ gpio_keys_get_devtree_pdata(struct device *dev) | |||
644 | button = &pdata->buttons[i++]; | 643 | button = &pdata->buttons[i++]; |
645 | 644 | ||
646 | button->gpio = gpio; | 645 | button->gpio = gpio; |
647 | button->irq = irq; | ||
648 | button->active_low = flags & OF_GPIO_ACTIVE_LOW; | 646 | button->active_low = flags & OF_GPIO_ACTIVE_LOW; |
649 | 647 | ||
650 | if (of_property_read_u32(pp, "linux,code", &button->code)) { | 648 | if (of_property_read_u32(pp, "linux,code", &button->code)) { |