Content-Type: multipart/mixed; boundary="===============1984344845545484456==" MIME-Version: 1.0 From: kernel test robot Subject: [PATCH] coccinelle: iterators: fix for_each_child.cocci warnings Date: Wed, 20 Jan 2021 22:17:28 +0800 Message-ID: <20210120141728.GA42834@0b6b305f7400> In-Reply-To: <202101202209.p89j5QKl-lkp@intel.com> List-Id: To: kbuild@lists.01.org --===============1984344845545484456== 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: Felipe Balbi CC: "Greg Kroah-Hartman" CC: Joel Stanley CC: Andrew Jeffery CC: Tao Ren CC: Benjamin Herrenschmidt CC: linux-usb(a)vger.kernel.org CC: linux-arm-kernel(a)lists.infradead.org From: kernel test robot drivers/usb/gadget/udc/aspeed-vhub/hub.c:982:1-23: WARNING: Function "for_e= ach_child_of_node" should have of_node_put() before break around line 1003. 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 Fixes: 82c2d81361ec ("coccinelle: iterators: Add for_each_child.cocci scrip= t") 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: 45dfb8a5659ad286c28fa59008271dbc4e5e3f2d commit: 82c2d81361ecd142a54e84a9da1e287113314a4f coccinelle: iterators: Add= for_each_child.cocci script :::::: branch date: 17 hours ago :::::: commit date: 3 months ago Please take the patch only if it's a positive warning. Thanks! hub.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/usb/gadget/udc/aspeed-vhub/hub.c +++ b/drivers/usb/gadget/udc/aspeed-vhub/hub.c @@ -999,8 +999,10 @@ static int ast_vhub_of_parse_str_desc(st str_array[offset].s =3D NULL; = ret =3D ast_vhub_str_alloc_add(vhub, &lang_str); - if (ret) + if (ret) { + of_node_put(child); break; + } } = return ret; --===============1984344845545484456==--