Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1665469 > unrolled thread
| Started by | Arvind Yadav <arvind.yadav.cs@gmail.com> |
|---|---|
| First post | 2017-06-14 08:10 +0200 |
| Last post | 2017-06-14 16:40 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] usb: host: ohci-pxa27x: Handle return value of clk_prepare_enable Arvind Yadav <arvind.yadav.cs@gmail.com> - 2017-06-14 08:10 +0200
Re: [PATCH] usb: host: ohci-pxa27x: Handle return value of clk_prepare_enable Alan Stern <stern@rowland.harvard.edu> - 2017-06-14 16:40 +0200
| From | Arvind Yadav <arvind.yadav.cs@gmail.com> |
|---|---|
| Date | 2017-06-14 08:10 +0200 |
| Subject | [PATCH] usb: host: ohci-pxa27x: Handle return value of clk_prepare_enable |
| Message-ID | <tS9F7-1we-9@gated-at.bofh.it> |
clk_prepare_enable() can fail here and we must check its return value.
Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
drivers/usb/host/ohci-pxa27x.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c
index 79efde8f..c5afdb2 100644
--- a/drivers/usb/host/ohci-pxa27x.c
+++ b/drivers/usb/host/ohci-pxa27x.c
@@ -281,7 +281,9 @@ static int pxa27x_start_hc(struct pxa27x_ohci *pxa_ohci, struct device *dev)
inf = dev_get_platdata(dev);
- clk_prepare_enable(pxa_ohci->clk);
+ retval = clk_prepare_enable(pxa_ohci->clk);
+ if (retval)
+ return retval;
pxa27x_reset_hc(pxa_ohci);
@@ -296,8 +298,10 @@ static int pxa27x_start_hc(struct pxa27x_ohci *pxa_ohci, struct device *dev)
if (inf->init)
retval = inf->init(dev);
- if (retval < 0)
+ if (retval < 0) {
+ clk_disable_unprepare(pxa_ohci->clk);
return retval;
+ }
if (cpu_is_pxa3xx())
pxa3xx_u2d_start_hc(&hcd->self);
--
1.9.1
[toc] | [next] | [standalone]
| From | Alan Stern <stern@rowland.harvard.edu> |
|---|---|
| Date | 2017-06-14 16:40 +0200 |
| Subject | Re: [PATCH] usb: host: ohci-pxa27x: Handle return value of clk_prepare_enable |
| Message-ID | <tShCG-6mB-11@gated-at.bofh.it> |
| In reply to | #1665469 |
On Wed, 14 Jun 2017, Arvind Yadav wrote:
> clk_prepare_enable() can fail here and we must check its return value.
>
> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
> ---
> drivers/usb/host/ohci-pxa27x.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c
> index 79efde8f..c5afdb2 100644
> --- a/drivers/usb/host/ohci-pxa27x.c
> +++ b/drivers/usb/host/ohci-pxa27x.c
> @@ -281,7 +281,9 @@ static int pxa27x_start_hc(struct pxa27x_ohci *pxa_ohci, struct device *dev)
>
> inf = dev_get_platdata(dev);
>
> - clk_prepare_enable(pxa_ohci->clk);
> + retval = clk_prepare_enable(pxa_ohci->clk);
> + if (retval)
> + return retval;
You might as well remove the initializer for retval ("int retval = 0;")
because the initial value will always be overwritten here.
>
> pxa27x_reset_hc(pxa_ohci);
>
> @@ -296,8 +298,10 @@ static int pxa27x_start_hc(struct pxa27x_ohci *pxa_ohci, struct device *dev)
> if (inf->init)
> retval = inf->init(dev);
>
> - if (retval < 0)
> + if (retval < 0) {
> + clk_disable_unprepare(pxa_ohci->clk);
> return retval;
> + }
>
> if (cpu_is_pxa3xx())
> pxa3xx_u2d_start_hc(&hcd->self);
Aside from that one issue,
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Alan Stern
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web