Skip to contentSkip to conversation

drivers/usb/gadget/udc/aspeed-vhub/hub.c:982:1-23: WARNING: Function "for_each_child_of_node" should have of_node_put() before break around line 1003.

DISCUSSION kernel test robot 1 participant 2 messages Jan 20, 2021

Subsystems (2)
lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw

CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Sumera Priyadarsini <[email protected]>
CC: Julia Lawall <[email protected]>

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
date:   3 months ago

:::::: branch date: 17 hours ago
:::::: commit date: 3 months ago
config: m68k-randconfig-c003-20210120 (attached as .config)
compiler: m68k-linux-gcc (GCC) 9.3.0

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

"coccinelle warnings: (new ones prefixed by >>)"

>> drivers/usb/gadget/udc/aspeed-vhub/hub.c:982:1-23: WARNING: Function "for_each_child_of_node" should have of_node_put() before break around line 1003.

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] coccinelle: iterators: fix for_each_child.cocci warnings

CC: kbuild-all(a)lists.01.org CC: linux-kernel(a)vger.kernel.org TO: Sumera Priyadarsini <[email protected]> CC: Julia Lawall <[email protected]> CC: Felipe Balbi <[email protected]> CC…

CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Sumera Priyadarsini <[email protected]>
CC: Julia Lawall <[email protected]>
CC: Felipe Balbi <[email protected]>
CC: "Greg Kroah-Hartman" <[email protected]>
CC: Joel Stanley <[email protected]>
CC: Andrew Jeffery <[email protected]>
CC: Tao Ren <[email protected]>
CC: Benjamin Herrenschmidt <[email protected]>
CC: linux-usb(a)vger.kernel.org
CC: linux-arm-kernel(a)lists.infradead.org

From: kernel test robot <[email protected]>

drivers/usb/gadget/udc/aspeed-vhub/hub.c:982:1-23: WARNING: Function "for_each_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 script")
CC Sumera Priyadarsini <[email protected]>

---

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(-)
drivers/usb/gadget/udc/aspeed-vhub/hub.c +3 -1
@@ -999,8 +999,10 @@ static int ast_vhub_of_parse_str_desc(st
 		str_array[offset].s = NULL;
 
 		ret = ast_vhub_str_alloc_add(vhub, &lang_str);
-		if (ret)
+		if (ret) {
+			of_node_put(child);
 			break;
+		}
 	}
 
 	return ret;