uint32_t cmd, reg;
int max_ports = HCS_N_PORTS(ehci_readl(&ctrl->hccr->cr_hcsparams));
- if (!ctrl || !ctrl->hcor)
- return -EINVAL;
-
cmd = ehci_readl(&ctrl->hcor->or_usbcmd);
/* If not run, directly return */
if (!(cmd & CMD_RUN))
rc = ehci_hcd_init(index, init, &ctrl->hccr, &ctrl->hcor);
if (rc)
return rc;
+ if (!ctrl->hccr || !ctrl->hcor)
+ return -1;
if (init == USB_INIT_DEVICE)
goto done;
{
struct usb_bus_priv *priv = dev_get_uclass_priv(dev);
struct ehci_ctrl *ctrl = dev_get_priv(dev);
- int ret;
+ int ret = -1;
debug("%s: dev='%s', ctrl=%p, hccr=%p, hcor=%p, init=%d\n", __func__,
dev->name, ctrl, hccr, hcor, init);
+ if (!ctrl || !hccr || !hcor)
+ goto err;
+
priv->desc_before_addr = true;
ehci_setup_ops(ctrl, ops);