diff options
author | Andrey Smirnov <andrew.smirnov@gmail.com> | 2017-03-08 14:09:02 -0800 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2017-03-09 11:51:27 +0100 |
commit | bf09557360b40d19ba8fd6e0a052d3849dda3a66 (patch) | |
tree | 7a5d4585a249c4cc16d39a19a011a525b89937fc /drivers/usb/host | |
parent | fb1ff1794a29a282927bd859e3c6ff2a304a8ea6 (diff) | |
download | barebox-bf09557360b40d19ba8fd6e0a052d3849dda3a66.tar.gz barebox-bf09557360b40d19ba8fd6e0a052d3849dda3a66.tar.xz |
usb: ohci-at91: Check result of clk_enable()
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/usb/host')
-rw-r--r-- | drivers/usb/host/ohci-at91.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c index cd7b321fda..5f745264b7 100644 --- a/drivers/usb/host/ohci-at91.c +++ b/drivers/usb/host/ohci-at91.c @@ -34,10 +34,23 @@ struct ohci_at91_priv { struct ohci_regs __iomem *regs; }; -static void at91_start_clock(struct ohci_at91_priv *ohci_at91) +static int at91_start_clock(struct ohci_at91_priv *ohci_at91) { - clk_enable(ohci_at91->iclk); - clk_enable(ohci_at91->fclk); + int ret; + + ret = clk_enable(ohci_at91->iclk); + if (ret < 0) { + dev_err(ohci_at91->dev, "Failed to enable 'iclk'\n"); + return ret; + } + + ret = clk_enable(ohci_at91->fclk); + if (ret < 0) { + dev_err(ohci_at91->dev, "Failed to enable 'fclk'\n"); + return ret; + } + + return 0; } static void at91_stop_clock(struct ohci_at91_priv *ohci_at91) @@ -48,6 +61,7 @@ static void at91_stop_clock(struct ohci_at91_priv *ohci_at91) static int at91_ohci_probe(struct device_d *dev) { + int ret; struct resource *io; struct ohci_at91_priv *ohci_at91 = xzalloc(sizeof(*ohci_at91)); @@ -76,7 +90,9 @@ static int at91_ohci_probe(struct device_d *dev) /* * Start the USB clocks. */ - at91_start_clock(ohci_at91); + ret = at91_start_clock(ohci_at91); + if (ret < 0) + return ret; /* * The USB host controller must remain in reset. |