From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============7282574711178492527==" MIME-Version: 1.0 From: kernel test robot Subject: [PATCH] coccinelle: iterators: fix for_each_child.cocci warnings Date: Tue, 03 Aug 2021 17:43:46 +0800 Message-ID: <20210803094346.GA44901@34bff7c39a32> In-Reply-To: <202108031732.QDAsXm3N-lkp@intel.com> List-Id: To: kbuild@lists.01.org --===============7282574711178492527== 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-kernel(a)vger.kernel.org TO: Sumera Priyadarsini CC: Julia Lawall CC: Michael Ellerman CC: Benjamin Herrenschmidt CC: Paul Mackerras CC: linuxppc-dev(a)lists.ozlabs.org CC: linux-kernel(a)vger.kernel.org From: kernel test robot arch/powerpc/kexec/core_64.c:54:1-22: WARNING: Function "for_each_node_by_t= ype" should have of_node_put() before return around line 68. 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: Sumera Priyadarsini Reported-by: kernel test robot Signed-off-by: kernel test robot --- tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git = master head: c500bee1c5b2f1d59b1081ac879d73268ab0ff17 commit: 82c2d81361ecd142a54e84a9da1e287113314a4f coccinelle: iterators: Add= for_each_child.cocci script :::::: branch date: 34 hours ago :::::: commit date: 10 months ago Please take the patch only if it's a positive warning. Thanks! core_64.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/arch/powerpc/kexec/core_64.c +++ b/arch/powerpc/kexec/core_64.c @@ -64,8 +64,10 @@ int default_machine_kexec_prepare(struct begin =3D image->segment[i].mem; end =3D begin + image->segment[i].memsz; = - if ((begin < high) && (end > low)) + if ((begin < high) && (end > low)) { + of_node_put(node); return -ETXTBSY; + } } } =20 --===============7282574711178492527==--