Skip to contentSkip to conversation

drivers/iio/adc/versal-sysmon.c:876:1-23: WARNING: Function "for_each_child_of_node" should have of_node_put() before return around line 879.

PATCH kernel test robot 1 participant 2 messages Feb 9, 2022

Subsystems (2)
lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw

CC: kbuild-all(a)lists.01.org
CC: linux-arm-kernel(a)lists.infradead.org
TO: Anand Ashok Dumbre <[email protected]>
CC: Michal Simek <[email protected]>
CC: Dragan Cvetic <[email protected]>

tree:   https://github.com/Xilinx/linux-xlnx xlnx_rebase_v5.15
head:   423a108a01e05e84b59a4c4885c16bf3cd8c90c7
commit: 1459646ab280aa68c3c4fa1d9552ea21f15d7a2d [543/907] iio: versal-sysmon: add driver for Versal Sysmon

:::::: branch date: 10 hours ago
:::::: commit date: 9 days ago
config: alpha-randconfig-c024-20220208 (https://download.01.org/0day-ci/archive/20220210/202202100352.j4CqVkcK-lkp(a)intel.com/config)
compiler: alpha-linux-gcc (GCC) 11.2.0

If you fix the issue, kindly add following tag as appropriate

cocci warnings: (new ones prefixed by >>)

>> drivers/iio/adc/versal-sysmon.c:876:1-23: WARNING: Function "for_each_child_of_node" should have of_node_put() before return around line 879.

drivers/iio/adc/versal-sysmon.c:876:1-23: WARNING: Function "for_each_child_of_node" should have of_node_put() before return around line 883.

Please review and possibly fold the followup patch.

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

author build bot
#1 lore raw

[PATCH] iio: versal-sysmon: fix for_each_child.cocci warnings

CC: kbuild-all(a)lists.01.org CC: linux-arm-kernel(a)lists.infradead.org TO: Anand Ashok Dumbre <[email protected]> CC: Michal Simek <[email protected]> CC: Dragan Cvetic…

CC: kbuild-all(a)lists.01.org
CC: linux-arm-kernel(a)lists.infradead.org
TO: Anand Ashok Dumbre <[email protected]>
CC: Michal Simek <[email protected]>
CC: Dragan Cvetic <[email protected]>
CC: Jonathan Cameron <[email protected]>
CC: "Lars-Peter Clausen" <[email protected]>
CC: git(a)xilinx.com
CC: linux-iio(a)vger.kernel.org
CC: linux-kernel(a)vger.kernel.org

From: kernel test robot <[email protected]>

drivers/iio/adc/versal-sysmon.c:876:1-23: WARNING: Function "for_each_child_of_node" should have of_node_put() before return around line 879. drivers/iio/adc/versal-sysmon.c:876:1-23: WARNING: Function "for_each_child_of_node" should have of_node_put() before return around line 883.

Semantic patch information:
False positives can be due to function calls within the for_each loop that may encapsulate an of_node_put.

Generated by: scripts/coccinelle/iterators/for_each_child.cocci

---

tree:   https://github.com/Xilinx/linux-xlnx xlnx_rebase_v5.15
head:   423a108a01e05e84b59a4c4885c16bf3cd8c90c7
commit: 1459646ab280aa68c3c4fa1d9552ea21f15d7a2d [543/907] iio: versal-sysmon: add driver for Versal Sysmon

:::::: branch date: 10 hours ago
:::::: commit date: 9 days ago

Please take the patch only if it's a positive warning. Thanks!

 versal-sysmon.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/iio/adc/versal-sysmon.c +6 -2
@@ -875,12 +875,16 @@ static int sysmon_parse_dt(struct iio_de
 
 	for_each_child_of_node(np, child_node) {
 		ret = of_property_read_u32(child_node, "reg", &reg);
-		if (ret < 0)
+		if (ret < 0) {
+			of_node_put(child_node);
 			return ret;
+		}
 
 		ret = of_property_read_string(child_node, "xlnx,name", &name);
-		if (ret < 0)
+		if (ret < 0) {
+			of_node_put(child_node);
 			return ret;
+		}
 
 		sysmon_channels[i].type = IIO_VOLTAGE;
 		sysmon_channels[i].indexed = 1;