Skip to contentSkip to conversation

usb: dwc3: fix for_each_child.cocci warnings

PATCH New Julia Lawall 1 participant 1 message May 22, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: dwc3: fix for_each_child.cocci warnings

From: kernel test robot <[email protected]>

Add missing of_node_puts.

Generated by: scripts/coccinelle/iterators/for_each_child.cocci

---

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

 drivers/usb/dwc3/core.c |   16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
drivers/usb/dwc3/core.c +12 -4
@@ -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++;
 		}