diff options
author | Alexander Shiyan <shc_work@mail.ru> | 2013-10-21 12:24:22 +0400 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2013-10-22 08:53:23 +0200 |
commit | 139a88a3370ac2651c989a5175c4f147f5465e12 (patch) | |
tree | c25b98dcf970e9c76abd18f06ea9935ba4250601 /drivers/usb/host/ehci-hcd.c | |
parent | cf9b0c6927126a4f6e520a242378b5166aaa87a4 (diff) | |
download | barebox-139a88a3370ac2651c989a5175c4f147f5465e12.tar.gz barebox-139a88a3370ac2651c989a5175c4f147f5465e12.tar.xz |
USB: Check init/post_init errors
Host with inoperable ULPI able to bring the system into an
infinite loop. The patch adds error checking during initialization
to avoid this.
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/usb/host/ehci-hcd.c')
-rw-r--r-- | drivers/usb/host/ehci-hcd.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index cb6a592466..2da3edd296 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c @@ -748,6 +748,7 @@ static int ehci_init(struct usb_host *host) struct ehci_priv *ehci = to_ehci(host); uint32_t reg; uint32_t cmd; + int ret = 0; ehci_halt(ehci); @@ -755,8 +756,11 @@ static int ehci_init(struct usb_host *host) if (ehci_reset(ehci) != 0) return -1; - if (ehci->init) - ehci->init(ehci->drvdata); + if (ehci->init) { + ret = ehci->init(ehci->drvdata); + if (ret) + return ret; + } ehci->qh_list->qh_link = cpu_to_hc32((uint32_t)ehci->qh_list | QH_LINK_TYPE_QH); ehci->qh_list->qh_endpt1 = cpu_to_hc32((1 << 15) | (USB_SPEED_HIGH << 12)); @@ -799,9 +803,9 @@ static int ehci_init(struct usb_host *host) ehci->rootdev = 0; if (ehci->post_init) - ehci->post_init(ehci->drvdata); + ret = ehci->post_init(ehci->drvdata); - return 0; + return ret; } static int |