From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============2105421260893101851==" MIME-Version: 1.0 From: kernel test robot Subject: [PATCH] usb: dwc3: fix for_each_child.cocci warnings Date: Sun, 22 May 2022 11:38:01 +0800 Message-ID: In-Reply-To: <202205221139.tP4hE1f1-lkp@intel.com> List-Id: To: kbuild@lists.01.org --===============2105421260893101851== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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_ch= ild_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_ch= ild_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_ch= ild_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_ch= ild_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-su= pport-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 =3D=3D -ENXIO || ret =3D=3D -ENODEV) dwc->usb2_phy[i] =3D 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 =3D=3D -ENXIO || ret =3D=3D -ENODEV) dwc->usb3_phy[i] =3D 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 =3D devm_phy_get(dev, "usb2-phy"); @@ -1412,8 +1416,10 @@ static int dwc3_core_get_phy(struct dwc3 ret =3D PTR_ERR(dwc->usb2_generic_phy); if (ret =3D=3D -ENOSYS || ret =3D=3D -ENODEV) dwc->usb2_generic_phy =3D 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 =3D PTR_ERR(dwc->usb3_generic_phy); if (ret =3D=3D -ENOSYS || ret =3D=3D -ENODEV) dwc->usb3_generic_phy =3D NULL; - else + else { + of_node_put(port); return dev_err_probe(dev, ret, "no usb3 phy configured\n"); + } } i++; } --===============2105421260893101851==--