2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-26 06:04:14 +08:00

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 <wanjiabing@vivo.com>
Link: https://lore.kernel.org/r/20211029024918.5161-1-wanjiabing@vivo.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
This commit is contained in:
Wan Jiabing 2021-10-28 22:49:18 -04:00 committed by Guenter Roeck
parent 38d9f06c57
commit 10f0d2ab9a

View 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;
}
}
}