Skip to content

Commit 10f0d2a

Browse files
Wan Jiabinggroeck
authored andcommitted
hwmon: (nct7802) Add of_node_put() before return
Fix following coccicheck warning: ./drivers/hwmon/nct7802.c:1152:2-24: 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 38d9f06 commit 10f0d2a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/hwmon/nct7802.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1152,8 +1152,10 @@ static int nct7802_configure_channels(struct device *dev,
11521152
for_each_child_of_node(dev->of_node, node) {
11531153
err = nct7802_get_channel_config(dev, node, &mode_mask,
11541154
&mode_val);
1155-
if (err)
1155+
if (err) {
1156+
of_node_put(node);
11561157
return err;
1158+
}
11571159
}
11581160
}
11591161

0 commit comments

Comments
 (0)