* [PATCH v2] usb: host: ohci-pxa27x: Handle return value of clk_prepare_enable
@ 2017-06-15 4:50 Arvind Yadav
2017-06-24 7:56 ` Greg KH
0 siblings, 1 reply; 2+ messages in thread
From: Arvind Yadav @ 2017-06-15 4:50 UTC (permalink / raw)
To: stern, gregkh; +Cc: linux-usb, linux-kernel
clk_prepare_enable() can fail here and we must check its return value.
Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Changes in v2:
Remove useless initialization of retval.
---
drivers/usb/host/ohci-pxa27x.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c
index 79efde8f..21c010f 100644
--- a/drivers/usb/host/ohci-pxa27x.c
+++ b/drivers/usb/host/ohci-pxa27x.c
@@ -274,14 +274,16 @@ static inline void pxa27x_reset_hc(struct pxa27x_ohci *pxa_ohci)
static int pxa27x_start_hc(struct pxa27x_ohci *pxa_ohci, struct device *dev)
{
- int retval = 0;
+ int retval;
struct pxaohci_platform_data *inf;
uint32_t uhchr;
struct usb_hcd *hcd = dev_get_drvdata(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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] usb: host: ohci-pxa27x: Handle return value of clk_prepare_enable
2017-06-15 4:50 [PATCH v2] usb: host: ohci-pxa27x: Handle return value of clk_prepare_enable Arvind Yadav
@ 2017-06-24 7:56 ` Greg KH
0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2017-06-24 7:56 UTC (permalink / raw)
To: Arvind Yadav; +Cc: stern, linux-usb, linux-kernel
On Thu, Jun 15, 2017 at 10:20:18AM +0530, 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>
>
> Changes in v2:
> Remove useless initialization of retval.
> ---
changes go below the --- line. Please fix and resend.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-06-24 7:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-15 4:50 [PATCH v2] usb: host: ohci-pxa27x: Handle return value of clk_prepare_enable Arvind Yadav
2017-06-24 7:56 ` Greg KH
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.