From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============7963765295474683798==" MIME-Version: 1.0 From: kernel test robot Subject: [PATCH] iio: versal-sysmon: fix for_each_child.cocci warnings Date: Sun, 13 Feb 2022 05:28:38 +0800 Message-ID: <20220212212838.GA21609@00bcc9f45bcd> In-Reply-To: <202202130525.AeZFNTY0-lkp@intel.com> List-Id: To: kbuild@lists.01.org --===============7963765295474683798== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable CC: kbuild-all(a)lists.01.org CC: linux-arm-kernel(a)lists.infradead.org TO: Anand Ashok Dumbre CC: Michal Simek CC: Dragan Cvetic CC: Jonathan Cameron CC: "Lars-Peter Clausen" CC: git(a)xilinx.com CC: linux-iio(a)vger.kernel.org CC: linux-kernel(a)vger.kernel.org From: kernel test robot 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 CC: Anand Ashok Dumbre Reported-by: kernel test robot Signed-off-by: kernel test robot --- tree: https://github.com/Xilinx/linux-xlnx xlnx_rebase_v5.15 head: 966124532656bc95d781abf57531e4cd4f962237 commit: 1459646ab280aa68c3c4fa1d9552ea21f15d7a2d [543/923] iio: versal-sysm= on: add driver for Versal Sysmon :::::: branch date: 3 days ago :::::: commit date: 12 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(-) --- a/drivers/iio/adc/versal-sysmon.c +++ b/drivers/iio/adc/versal-sysmon.c @@ -875,12 +875,16 @@ static int sysmon_parse_dt(struct iio_de = for_each_child_of_node(np, child_node) { ret =3D of_property_read_u32(child_node, "reg", ®); - if (ret < 0) + if (ret < 0) { + of_node_put(child_node); return ret; + } = ret =3D 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 =3D IIO_VOLTAGE; sysmon_channels[i].indexed =3D 1; --===============7963765295474683798==--