Input: gpio_keys - fix warning regarding uninitialized 'button' variable
Commit af906faabc
("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>
This commit is contained in:
parent
66aee90088
commit
1d6a01365f
@ -621,9 +621,12 @@ gpio_keys_get_devtree_pdata(struct device *dev)
|
|||||||
int gpio = -1;
|
int gpio = -1;
|
||||||
enum of_gpio_flags flags;
|
enum of_gpio_flags flags;
|
||||||
|
|
||||||
|
button = &pdata->buttons[i++];
|
||||||
|
|
||||||
if (!of_find_property(pp, "gpios", NULL)) {
|
if (!of_find_property(pp, "gpios", NULL)) {
|
||||||
button->irq = irq_of_parse_and_map(pp, 0);
|
button->irq = irq_of_parse_and_map(pp, 0);
|
||||||
if (button->irq == 0) {
|
if (button->irq == 0) {
|
||||||
|
i--;
|
||||||
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;
|
||||||
@ -640,8 +643,6 @@ gpio_keys_get_devtree_pdata(struct device *dev)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
button = &pdata->buttons[i++];
|
|
||||||
|
|
||||||
button->gpio = gpio;
|
button->gpio = gpio;
|
||||||
button->active_low = flags & OF_GPIO_ACTIVE_LOW;
|
button->active_low = flags & OF_GPIO_ACTIVE_LOW;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user