]> Git Repo - J-linux.git/commitdiff
hwmon: (nct7802) Add of_node_put() before return
authorWan Jiabing <[email protected]>
Fri, 29 Oct 2021 02:49:18 +0000 (22:49 -0400)
committerGuenter Roeck <[email protected]>
Fri, 29 Oct 2021 04:27:38 +0000 (21:27 -0700)
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]>
drivers/hwmon/nct7802.c

index d56f783276191fce2332c6978197fb7efc7bd753..d1eeef02b6dc8375ee7a3f818f6e6eff37588ed0 100644 (file)
@@ -1152,8 +1152,10 @@ static int nct7802_configure_channels(struct device *dev,
                for_each_child_of_node(dev->of_node, node) {
                        err = nct7802_get_channel_config(dev, node, &mode_mask,
                                                         &mode_val);
-                       if (err)
+                       if (err) {
+                               of_node_put(node);
                                return err;
+                       }
                }
        }
 
This page took 0.054157 seconds and 4 git commands to generate.