Skip to content

Commit 66ae4d5

Browse files
Wan Jiabinggroeck
authored andcommitted
hwmon: (tmp421) Add of_node_put() before return
Fix following coccicheck warning: ./drivers/hwmon/tmp421.c:416:1-23: WARNING: Function for_each_child_of_node should have of_node_put() before return. Early exits from for_each_child_of_node should decrement the node reference counter. Signed-off-by: Wan Jiabing <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Guenter Roeck <[email protected]>
1 parent efb389b commit 66ae4d5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/hwmon/tmp421.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,8 +418,10 @@ static int tmp421_probe_from_dt(struct i2c_client *client, struct tmp421_data *d
418418
continue;
419419

420420
err = tmp421_probe_child_from_dt(client, child, data);
421-
if (err)
421+
if (err) {
422+
of_node_put(child);
422423
return err;
424+
}
423425
}
424426

425427
return 0;

0 commit comments

Comments
 (0)