Commit af906faa authored by Dmitry Torokhov's avatar Dmitry Torokhov

Input: gpio_keys - fix warning regarding uninitialized 'irq' variable

Commit f2d347ff ("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: default avatarOlof's autobuilder <build@lixom.net>
Reported-by: default avatarFabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent 823a11fd
...@@ -619,12 +619,11 @@ gpio_keys_get_devtree_pdata(struct device *dev) ...@@ -619,12 +619,11 @@ gpio_keys_get_devtree_pdata(struct device *dev)
i = 0; i = 0;
for_each_child_of_node(node, pp) { for_each_child_of_node(node, pp) {
int gpio = -1; int gpio = -1;
int irq;
enum of_gpio_flags flags; enum of_gpio_flags flags;
if (!of_find_property(pp, "gpios", NULL)) { if (!of_find_property(pp, "gpios", NULL)) {
irq = irq_of_parse_and_map(pp, 0); button->irq = irq_of_parse_and_map(pp, 0);
if (irq == 0) { if (button->irq == 0) {
pdata->nbuttons--; pdata->nbuttons--;
dev_warn(dev, "Found button without gpios or irqs\n"); dev_warn(dev, "Found button without gpios or irqs\n");
continue; continue;
...@@ -644,7 +643,6 @@ gpio_keys_get_devtree_pdata(struct device *dev) ...@@ -644,7 +643,6 @@ gpio_keys_get_devtree_pdata(struct device *dev)
button = &pdata->buttons[i++]; button = &pdata->buttons[i++];
button->gpio = gpio; button->gpio = gpio;
button->irq = irq;
button->active_low = flags & OF_GPIO_ACTIVE_LOW; button->active_low = flags & OF_GPIO_ACTIVE_LOW;
if (of_property_read_u32(pp, "linux,code", &button->code)) { if (of_property_read_u32(pp, "linux,code", &button->code)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment