瀏覽代碼

usb: host: ohci-generic: initialize PHY only when found

Call generic_phy_init() only when a PHY was found.
This will avoid a crash if no "phys" property is found in DT.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reported-by: Patrick Delaunay <patrick.delaunay@st.com>
Patrice Chotard 7 年之前
父節點
當前提交
2080d023d9
共有 1 個文件被更改,包括 6 次插入5 次删除
  1. 6 5
      drivers/usb/host/ohci-generic.c

+ 6 - 5
drivers/usb/host/ohci-generic.c

@@ -91,12 +91,13 @@ static int ohci_usb_probe(struct udevice *dev)
 			error("failed to get usb phy\n");
 			goto reset_err;
 		}
-	}
+	} else {
 
-	err = generic_phy_init(&priv->phy);
-	if (err) {
-		error("failed to init usb phy\n");
-		goto reset_err;
+		err = generic_phy_init(&priv->phy);
+		if (err) {
+			error("failed to init usb phy\n");
+			goto reset_err;
+		}
 	}
 
 	err = ohci_register(dev, regs);