Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <wanjiabing@vivo.com>
Link: https://lore.kernel.org/r/20211018121538.16482-1-wanjiabing@vivo.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>

authored by

Wan Jiabing and committed by
Guenter Roeck
66ae4d56 efb389b8

+3 -1
+3 -1
drivers/hwmon/tmp421.c
··· 418 418 continue; 419 419 420 420 err = tmp421_probe_child_from_dt(client, child, data); 421 - if (err) 421 + if (err) { 422 + of_node_put(child); 422 423 return err; 424 + } 423 425 } 424 426 425 427 return 0;