Input: gpio_keys_polled - fix DT node reference leak
Subsystems (2)
Dmitry Torokhov
maintainerPATCH 1/1 Input: gpio_keys_polled - fix DT node reference leak
When someone requests button with wakeup (which this driver does not support) we should drop reference to the current child device node before returning error.
Note that when we using legacy platform data 'child' stays NULL which fwnode_handle_put() handles just fine.
--- drivers/input/keyboard/gpio_keys_polled.c | 1 + 1 file changed, 1 insertion(+)
drivers/input/keyboard/gpio_keys_polled.c +1 -0
@@ -291,6 +291,7 @@ static int gpio_keys_polled_probe(struct platform_device *pdev)if (button->wakeup) {dev_err (dev,DRV_NAME " does not support wakeup\n" ); +fwnode_handle_put (child);return -EINVAL ; }
Signature · 5 lines
2.8.0.rc3.226.g39d4020 -- Dmitry
Quoted 17 lines · Dmitry Torokhov
When someone requests button with wakeup (which this driver does not support) we should drop reference to the current child device node before returning error.
Note that when we using legacy platform data 'child' stays NULL which
fwnode_handle_put()handles just fine.Signed-off-by Dmitry Torokhov <[email protected]>--- drivers/input/keyboard/gpio_keys_polled.c | 1 + 1 file changed, 1 insertion(+)drivers/input/keyboard/gpio_keys_polled.c +0
-0
drivers/input/keyboard/gpio_keys_polled.c static int gpio_keys_polled_probe(struct platform_device *pdev) · line 294
Quoted 4 lines
drivers/input/keyboard/gpio_keys_polled.c +1
-0@@ -291,6 +291,7 @@ static int gpio_keys_polled_probe(struct platform_device *pdev)if (button->wakeup) {dev_err (dev,DRV_NAME " does not support wakeup\n" ); +fwnode_handle_put (child);
Are you sure this is the right place?
I didn't try to compile this but to me it looks like there is no variable named "child" in the whole gpio_keys_polled_probe() function. Unless I'm looking at wrong branch ;-)
Quoted 9 lines
drivers/input/keyboard/gpio_keys_polled.c +0
-0return -EINVAL ; }Signature · 5 lines
2.8.0.rc3.226.g39d4020 -- Dmitry
Dmitry Torokhov
maintainerQuoted 25 lines · Mika Westerberg
Quoted 17 lines · Dmitry Torokhov
When someone requests button with wakeup (which this driver does not support) we should drop reference to the current child device node before returning error.
Note that when we using legacy platform data 'child' stays NULL which
fwnode_handle_put()handles just fine.Signed-off-by Dmitry Torokhov <[email protected]>--- drivers/input/keyboard/gpio_keys_polled.c | 1 + 1 file changed, 1 insertion(+)drivers/input/keyboard/gpio_keys_polled.c +0
-0drivers/input/keyboard/gpio_keys_polled.c static int gpio_keys_polled_probe(struct platform_device *pdev) · line 294
Quoted 4 lines
drivers/input/keyboard/gpio_keys_polled.c +1
-0@@ -291,6 +291,7 @@ static int gpio_keys_polled_probe(struct platform_device *pdev)if (button->wakeup) {dev_err (dev,DRV_NAME " does not support wakeup\n" ); +fwnode_handle_put (child);Are you sure this is the right place?
Quoted 3 lines
I didn't try to compile this but to me it looks like there is no variable named "child" in the whole
gpio_keys_polled_probe()function. Unless I'm looking at wrong branch ;-)
Hmm, it was on top of my other change. I though I already published it, but since it turns out I didn't I will just fold this one in.
Thanks.
Signature · 1 line
Dmitry