Commit 1e1be6d4 authored by Marek Vasut's avatar Marek Vasut
Browse files

usb: ehci: Do not de-init uninited controllers

In case the controller is not initialized, we shall not de-initialize it.
As the control structure will not be filled, we will produce a null ptr
dereference if the controller is not inited.

Signed-off-by: default avatarMarek Vasut <>
Cc: Simon Glass <>
parent 8fb83547
......@@ -201,6 +201,9 @@ static int ehci_shutdown(struct ehci_ctrl *ctrl)
int i, ret = 0;
uint32_t cmd, reg;
if (!ctrl || !ctrl->hcor)
return -EINVAL;
cmd = ehci_readl(&ctrl->hcor->or_usbcmd);
cmd &= ~(CMD_PSE | CMD_ASE);
ehci_writel(&ctrl->hcor->or_usbcmd, cmd);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment