diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2014-12-07 22:42:45 -0800 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2014-12-07 23:07:07 -0800 |
commit | af906faabcf91eb12397d8954f89e289a8b96af5 (patch) | |
tree | 60ae6bb24d6f8a323e68a42d29e91144c22ecdf0 /drivers/input/keyboard/gpio_keys.c | |
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>
Diffstat (limited to 'drivers/input/keyboard/gpio_keys.c')
-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) i = 0; for_each_child_of_node(node, pp) { int gpio = -1; - int irq; enum of_gpio_flags flags; if (!of_find_property(pp, "gpios", NULL)) { - irq = irq_of_parse_and_map(pp, 0); - if (irq == 0) { + button->irq = irq_of_parse_and_map(pp, 0); + if (button->irq == 0) { pdata->nbuttons--; dev_warn(dev, "Found button without gpios or irqs\n"); continue; @@ -644,7 +643,6 @@ gpio_keys_get_devtree_pdata(struct device *dev) button = &pdata->buttons[i++]; button->gpio = gpio; - button->irq = irq; button->active_low = flags & OF_GPIO_ACTIVE_LOW; if (of_property_read_u32(pp, "linux,code", &button->code)) { |