Skip to content

Commit c90a851

Browse files
javiercarrascocruzdtor
authored andcommitted
Input: gpio_keys - use device_for_each_child_node_scoped()
Switch to the _scoped() version introduced in commit 365130f ("device property: Introduce device_for_each_child_node_scoped()") to remove the need for manual calling of fwnode_handle_put() in the paths where the code exits the loop early. Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com> Link: https://lore.kernel.org/r/20240412-input_device_for_each_child_node_scoped-v1-3-dbad1bc7ea84@gmail.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
1 parent 4f210af commit c90a851

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

drivers/input/keyboard/gpio_keys.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,6 @@ gpio_keys_get_devtree_pdata(struct device *dev)
768768
{
769769
struct gpio_keys_platform_data *pdata;
770770
struct gpio_keys_button *button;
771-
struct fwnode_handle *child;
772771
int nbuttons, irq;
773772

774773
nbuttons = device_get_child_node_count(dev);
@@ -790,7 +789,7 @@ gpio_keys_get_devtree_pdata(struct device *dev)
790789

791790
device_property_read_string(dev, "label", &pdata->name);
792791

793-
device_for_each_child_node(dev, child) {
792+
device_for_each_child_node_scoped(dev, child) {
794793
if (is_of_node(child)) {
795794
irq = of_irq_get_byname(to_of_node(child), "irq");
796795
if (irq > 0)
@@ -808,7 +807,6 @@ gpio_keys_get_devtree_pdata(struct device *dev)
808807
if (fwnode_property_read_u32(child, "linux,code",
809808
&button->code)) {
810809
dev_err(dev, "Button without keycode\n");
811-
fwnode_handle_put(child);
812810
return ERR_PTR(-EINVAL);
813811
}
814812

0 commit comments

Comments
 (0)