CC: kbuild-all(a)lists.01.org BCC: lkp(a)intel.com In-Reply-To: <1652963695-10109-3-git-send-email-quic_harshq@quicinc.com> References: <1652963695-10109-3-git-send-email-quic_harshq@quicinc.com> TO: Harsh Agarwal From: kernel test robot drivers/usb/dwc3/core.c:1386:2-34: WARNING: Function "for_each_available_child_of_node" should have of_node_put() before return around line 1398. drivers/usb/dwc3/core.c:1386:2-34: WARNING: Function "for_each_available_child_of_node" should have of_node_put() before return around line 1407. drivers/usb/dwc3/core.c:1386:2-34: WARNING: Function "for_each_available_child_of_node" should have of_node_put() before return around line 1416. drivers/usb/dwc3/core.c:1386:2-34: WARNING: Function "for_each_available_child_of_node" should have of_node_put() before return around line 1426. 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: Harsh Agarwal Reported-by: kernel test robot Signed-off-by: kernel test robot --- url: https://github.com/intel-lab-lkp/linux/commits/Harsh-Agarwal/Add-support-for-multiport-controller/20220519-203742 base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing :::::: branch date: 3 days ago :::::: commit date: 3 days ago Please take the patch only if it's a positive warning. Thanks! drivers/usb/dwc3/core.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -1394,8 +1394,10 @@ static int dwc3_core_get_phy(struct dwc3 pr_err("usb2_phy gone %d\n", ret); if (ret == -ENXIO || ret == -ENODEV) dwc->usb2_phy[i] = NULL; - else + else { + of_node_put(port); return dev_err_probe(dev, ret, "no usb2 phy configured\n"); + } } if (IS_ERR(dwc->usb3_phy[i])) { @@ -1403,8 +1405,10 @@ static int dwc3_core_get_phy(struct dwc3 pr_err("usb3_phy gone %d\n", ret); if (ret == -ENXIO || ret == -ENODEV) dwc->usb3_phy[i] = NULL; - else + else { + of_node_put(port); return dev_err_probe(dev, ret, "no usb3 phy configured\n"); + } } //TODO Write Generic PHY API dwc->usb2_generic_phy = devm_phy_get(dev, "usb2-phy"); @@ -1412,8 +1416,10 @@ static int dwc3_core_get_phy(struct dwc3 ret = PTR_ERR(dwc->usb2_generic_phy); if (ret == -ENOSYS || ret == -ENODEV) dwc->usb2_generic_phy = NULL; - else + else { + of_node_put(port); return dev_err_probe(dev, ret, "no usb2 phy configured\n"); + } } //TODO Write Generic PHY API @@ -1422,8 +1428,10 @@ static int dwc3_core_get_phy(struct dwc3 ret = PTR_ERR(dwc->usb3_generic_phy); if (ret == -ENOSYS || ret == -ENODEV) dwc->usb3_generic_phy = NULL; - else + else { + of_node_put(port); return dev_err_probe(dev, ret, "no usb3 phy configured\n"); + } } i++; }