summaryrefslogtreecommitdiff
path: root/drivers/usb
diff options
context:
space:
mode:
authorMarek Vasut <marex@denx.de>2013-12-14 02:03:11 +0100
committerMarek Vasut <marex@denx.de>2013-12-18 19:53:19 +0100
commit1e1be6d478c7c2cddf97e2623dd5c4c10bc23020 (patch)
tree6781728fbd8a026d88f0e614cdcba625a36bd7e3 /drivers/usb
parent8fb83547b93cd30a803eca1fec005b3d2b86a21f (diff)
downloadu-boot-imx-1e1be6d478c7c2cddf97e2623dd5c4c10bc23020.zip
u-boot-imx-1e1be6d478c7c2cddf97e2623dd5c4c10bc23020.tar.gz
u-boot-imx-1e1be6d478c7c2cddf97e2623dd5c4c10bc23020.tar.bz2
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: Marek Vasut <marex@denx.de> Cc: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/host/ehci-hcd.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 8bd1eb8..3ef204d 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -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);