Skip to content

Commit af906fa

Browse files
committed
Input: gpio_keys - fix warning regarding uninitialized 'irq' variable
Commit f2d347f ("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 <[email protected]> Reported-by: Fabio Estevam <[email protected]> Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent 823a11f commit af906fa

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/input/keyboard/gpio_keys.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -619,12 +619,11 @@ gpio_keys_get_devtree_pdata(struct device *dev)
619619
i = 0;
620620
for_each_child_of_node(node, pp) {
621621
int gpio = -1;
622-
int irq;
623622
enum of_gpio_flags flags;
624623

625624
if (!of_find_property(pp, "gpios", NULL)) {
626-
irq = irq_of_parse_and_map(pp, 0);
627-
if (irq == 0) {
625+
button->irq = irq_of_parse_and_map(pp, 0);
626+
if (button->irq == 0) {
628627
pdata->nbuttons--;
629628
dev_warn(dev, "Found button without gpios or irqs\n");
630629
continue;
@@ -644,7 +643,6 @@ gpio_keys_get_devtree_pdata(struct device *dev)
644643
button = &pdata->buttons[i++];
645644

646645
button->gpio = gpio;
647-
button->irq = irq;
648646
button->active_low = flags & OF_GPIO_ACTIVE_LOW;
649647

650648
if (of_property_read_u32(pp, "linux,code", &button->code)) {

0 commit comments

Comments
 (0)