|
@@ -1993,6 +1993,7 @@ static void udc_id_switch_for_host(struct ci_hdrc *ci)
|
|
|
int ci_hdrc_gadget_init(struct ci_hdrc *ci)
|
|
|
{
|
|
|
struct ci_role_driver *rdrv;
|
|
|
+ int ret;
|
|
|
|
|
|
if (!hw_read(ci, CAP_DCCPARAMS, DCCPARAMS_DC))
|
|
|
return -ENXIO;
|
|
@@ -2005,7 +2006,10 @@ int ci_hdrc_gadget_init(struct ci_hdrc *ci)
|
|
|
rdrv->stop = udc_id_switch_for_host;
|
|
|
rdrv->irq = udc_irq;
|
|
|
rdrv->name = "gadget";
|
|
|
- ci->roles[CI_ROLE_GADGET] = rdrv;
|
|
|
|
|
|
- return udc_start(ci);
|
|
|
+ ret = udc_start(ci);
|
|
|
+ if (!ret)
|
|
|
+ ci->roles[CI_ROLE_GADGET] = rdrv;
|
|
|
+
|
|
|
+ return ret;
|
|
|
}
|