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

Input: iqs62x-keys - use cleanup facility for fwnodes

Use __free(fwnode_handle) cleanup facility to ensure that references
to acquired fwnodes are dropped at appropriate times automatically.

Reviewed-by: Jeff LaBundy <jeff@labundy.com>
Link: https://lore.kernel.org/r/20240825051627.2848495-9-dmitry.torokhov@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

+2 -5
+2 -5
drivers/input/keyboard/iqs62x-keys.c
··· 45 45 static int iqs62x_keys_parse_prop(struct platform_device *pdev, 46 46 struct iqs62x_keys_private *iqs62x_keys) 47 47 { 48 - struct fwnode_handle *child; 49 48 unsigned int val; 50 49 int ret, i; 51 50 ··· 67 68 } 68 69 69 70 for (i = 0; i < ARRAY_SIZE(iqs62x_keys->switches); i++) { 70 - child = device_get_named_child_node(&pdev->dev, 71 + struct fwnode_handle *child __free(fwnode_handle) = 72 + device_get_named_child_node(&pdev->dev, 71 73 iqs62x_switch_names[i]); 72 74 if (!child) 73 75 continue; ··· 77 77 if (ret) { 78 78 dev_err(&pdev->dev, "Failed to read switch code: %d\n", 79 79 ret); 80 - fwnode_handle_put(child); 81 80 return ret; 82 81 } 83 82 iqs62x_keys->switches[i].code = val; ··· 90 91 iqs62x_keys->switches[i].flag = (i == IQS62X_SW_HALL_N ? 91 92 IQS62X_EVENT_HALL_N_T : 92 93 IQS62X_EVENT_HALL_S_T); 93 - 94 - fwnode_handle_put(child); 95 94 } 96 95 97 96 return 0;