All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC v2] usb: musb: omap: fix the error check for pm_runtime_get_sync
@ 2012-03-22 13:28 Shubhrajyoti D
  2012-03-22 17:36 ` Kevin Hilman
  0 siblings, 1 reply; 2+ messages in thread
From: Shubhrajyoti D @ 2012-03-22 13:28 UTC (permalink / raw)
  To: linux-omap-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA, balbi-l0cyMroinI0,
	Shubhrajyoti D

pm_runtime_get_sync returns a signed integer.In case of errors
it returns a negative value.This patch fixes the error check
by making it signed instead of unsigned thus preventing register
access if get_sync_fails. Also passes the error cause to the
debug message.

Cc :  Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org>
Signed-off-by: Shubhrajyoti D <shubhrajyoti-l0cyMroinI0@public.gmane.org>
---
Compile tested only

 drivers/usb/musb/omap2430.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index 2ae0bb3..e5dd18f 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -282,7 +282,8 @@ static void musb_otg_notifier_work(struct work_struct *data_notifier_work)
 
 static int omap2430_musb_init(struct musb *musb)
 {
-	u32 l, status = 0;
+	u32 l;
+	int status = 0;
 	struct device *dev = musb->controller;
 	struct musb_hdrc_platform_data *plat = dev->platform_data;
 	struct omap_musb_board_data *data = plat->board_data;
@@ -301,7 +302,7 @@ static int omap2430_musb_init(struct musb *musb)
 
 	status = pm_runtime_get_sync(dev);
 	if (status < 0) {
-		dev_err(dev, "pm_runtime_get_sync FAILED");
+		dev_err(dev, "pm_runtime_get_sync FAILED %d\n", status);
 		goto err1;
 	}
 
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH RFC v2] usb: musb: omap: fix the error check for pm_runtime_get_sync
  2012-03-22 13:28 [PATCH RFC v2] usb: musb: omap: fix the error check for pm_runtime_get_sync Shubhrajyoti D
@ 2012-03-22 17:36 ` Kevin Hilman
  0 siblings, 0 replies; 2+ messages in thread
From: Kevin Hilman @ 2012-03-22 17:36 UTC (permalink / raw)
  To: Shubhrajyoti D; +Cc: linux-omap, linux-usb, balbi

Shubhrajyoti D <shubhrajyoti@ti.com> writes:

> pm_runtime_get_sync returns a signed integer.In case of errors
> it returns a negative value.This patch fixes the error check
> by making it signed instead of unsigned thus preventing register
> access if get_sync_fails. Also passes the error cause to the
> debug message.
>
> Cc :  Kishon Vijay Abraham I <kishon@ti.com>
> Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
> ---
> Compile tested only
>
>  drivers/usb/musb/omap2430.c |    5 +++--
>  1 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
> index 2ae0bb3..e5dd18f 100644
> --- a/drivers/usb/musb/omap2430.c
> +++ b/drivers/usb/musb/omap2430.c
> @@ -282,7 +282,8 @@ static void musb_otg_notifier_work(struct work_struct *data_notifier_work)
>  
>  static int omap2430_musb_init(struct musb *musb)
>  {
> -	u32 l, status = 0;
> +	u32 l;
> +	int status = 0;

nit: you might as well drop the '= 0' assignment since it's not needed.

Otherwise, looks right to me.

Acked-by: Kevin Hilman <khilman@ti.com>

Kevin

>  	struct device *dev = musb->controller;
>  	struct musb_hdrc_platform_data *plat = dev->platform_data;
>  	struct omap_musb_board_data *data = plat->board_data;
> @@ -301,7 +302,7 @@ static int omap2430_musb_init(struct musb *musb)
>  
>  	status = pm_runtime_get_sync(dev);
>  	if (status < 0) {
> -		dev_err(dev, "pm_runtime_get_sync FAILED");
> +		dev_err(dev, "pm_runtime_get_sync FAILED %d\n", status);
>  		goto err1;
>  	}

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-03-22 17:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-22 13:28 [PATCH RFC v2] usb: musb: omap: fix the error check for pm_runtime_get_sync Shubhrajyoti D
2012-03-22 17:36 ` Kevin Hilman

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.