From: Gregory Herrero <[email protected]>
Signed-off-by: Gregory Herrero <[email protected]>
Signed-off-by: Mian Yousaf Kaukab <[email protected]>
---
drivers/usb/dwc2/gadget.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index 200168e..0b3c571 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -3411,7 +3411,7 @@ int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq)
struct device *dev = hsotg->dev;
struct s3c_hsotg_plat *plat = dev->platform_data;
struct phy *phy;
- struct usb_phy *uphy;
+ struct usb_phy *uphy = NULL;
struct s3c_hsotg_ep *eps;
int epnum;
int ret;
@@ -3555,12 +3555,20 @@ int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq)
if (ret)
goto err_ep_mem;
+ if (!IS_ERR_OR_NULL(uphy)) {
+ ret = otg_set_peripheral(uphy->otg, &hsotg->gadget);
+ if (ret && ret != -ENOTSUPP)
+ goto err_set_peripheral;
+ }
+
s3c_hsotg_create_debug(hsotg);
s3c_hsotg_dump(hsotg);
return 0;
+err_set_peripheral:
+ usb_del_gadget_udc(&hsotg->gadget);
err_ep_mem:
kfree(eps);
err_supplies:
--
2.1.0
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html