Skip to content

Commit 22df245

Browse files
committed
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>
1 parent 43a365a commit 22df245

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

drivers/input/keyboard/iqs62x-keys.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ struct iqs62x_keys_private {
4545
static int iqs62x_keys_parse_prop(struct platform_device *pdev,
4646
struct iqs62x_keys_private *iqs62x_keys)
4747
{
48-
struct fwnode_handle *child;
4948
unsigned int val;
5049
int ret, i;
5150

@@ -68,7 +67,8 @@ static int iqs62x_keys_parse_prop(struct platform_device *pdev,
6867
}
6968

7069
for (i = 0; i < ARRAY_SIZE(iqs62x_keys->switches); i++) {
71-
child = device_get_named_child_node(&pdev->dev,
70+
struct fwnode_handle *child __free(fwnode_handle) =
71+
device_get_named_child_node(&pdev->dev,
7272
iqs62x_switch_names[i]);
7373
if (!child)
7474
continue;
@@ -77,7 +77,6 @@ static int iqs62x_keys_parse_prop(struct platform_device *pdev,
7777
if (ret) {
7878
dev_err(&pdev->dev, "Failed to read switch code: %d\n",
7979
ret);
80-
fwnode_handle_put(child);
8180
return ret;
8281
}
8382
iqs62x_keys->switches[i].code = val;
@@ -91,8 +90,6 @@ static int iqs62x_keys_parse_prop(struct platform_device *pdev,
9190
iqs62x_keys->switches[i].flag = (i == IQS62X_SW_HALL_N ?
9291
IQS62X_EVENT_HALL_N_T :
9392
IQS62X_EVENT_HALL_S_T);
94-
95-
fwnode_handle_put(child);
9693
}
9794

9895
return 0;

0 commit comments

Comments
 (0)