{
ci_hdrc_gadget_destroy(ci);
ci_hdrc_host_destroy(ci);
-- if (ci->is_otg)
+- if (ci->is_otg && ci->roles[CI_ROLE_GADGET])
+ if (!ci->dp_always_pullup && ci->roles[CI_ROLE_GADGET])
ci_hdrc_otg_destroy(ci);
}
ret = hw_device_init(ci, base);
if (ret < 0) {
dev_err(dev, "can't initialize hardware\n");
-@@ -955,7 +958,7 @@ static int ci_hdrc_probe(struct platform
- goto deinit_phy;
+@@ -963,7 +966,7 @@ static int ci_hdrc_probe(struct platform
+ goto deinit_gadget;
}
- if (ci->is_otg && ci->roles[CI_ROLE_GADGET]) {