Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Input: adc-keys - use device_for_each_child_node_scoped()

Switch to the _scoped() version introduced in commit 365130fd47af
("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-5-dbad1bc7ea84@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by

Javier Carrasco and committed by
Dmitry Torokhov
44f9c7c5 1102db75

+1 -4
+1 -4
drivers/input/keyboard/adc-keys.c
··· 66 66 static int adc_keys_load_keymap(struct device *dev, struct adc_keys_state *st) 67 67 { 68 68 struct adc_keys_button *map; 69 - struct fwnode_handle *child; 70 69 int i; 71 70 72 71 st->num_keys = device_get_child_node_count(dev); ··· 79 80 return -ENOMEM; 80 81 81 82 i = 0; 82 - device_for_each_child_node(dev, child) { 83 + device_for_each_child_node_scoped(dev, child) { 83 84 if (fwnode_property_read_u32(child, "press-threshold-microvolt", 84 85 &map[i].voltage)) { 85 86 dev_err(dev, "Key with invalid or missing voltage\n"); 86 - fwnode_handle_put(child); 87 87 return -EINVAL; 88 88 } 89 89 map[i].voltage /= 1000; ··· 90 92 if (fwnode_property_read_u32(child, "linux,code", 91 93 &map[i].keycode)) { 92 94 dev_err(dev, "Key with invalid or missing linux,code\n"); 93 - fwnode_handle_put(child); 94 95 return -EINVAL; 95 96 } 96 97