Skip to content

Commit 1102db7

Browse files
javiercarrascocruzdtor
authored andcommitted
Input: gpio_keys_polled - 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-4-dbad1bc7ea84@gmail.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
1 parent c90a851 commit 1102db7

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

drivers/input/keyboard/gpio_keys_polled.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ gpio_keys_polled_get_devtree_pdata(struct device *dev)
144144
{
145145
struct gpio_keys_platform_data *pdata;
146146
struct gpio_keys_button *button;
147-
struct fwnode_handle *child;
148147
int nbuttons;
149148

150149
nbuttons = device_get_child_node_count(dev);
@@ -166,11 +165,10 @@ gpio_keys_polled_get_devtree_pdata(struct device *dev)
166165

167166
device_property_read_string(dev, "label", &pdata->name);
168167

169-
device_for_each_child_node(dev, child) {
168+
device_for_each_child_node_scoped(dev, child) {
170169
if (fwnode_property_read_u32(child, "linux,code",
171170
&button->code)) {
172171
dev_err(dev, "button without keycode\n");
173-
fwnode_handle_put(child);
174172
return ERR_PTR(-EINVAL);
175173
}
176174

0 commit comments

Comments
 (0)