public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC] usb: musb: omap: fix the error check for pm_runtime_get_sync
@ 2012-03-22  7:18 Shubhrajyoti D
       [not found] ` <1332400686-27674-1-git-send-email-shubhrajyoti-l0cyMroinI0@public.gmane.org>
  2012-03-22 12:42 ` Sergei Shtylyov
  0 siblings, 2 replies; 5+ messages in thread
From: Shubhrajyoti D @ 2012-03-22  7:18 UTC (permalink / raw)
  To: linux-omap; +Cc: linux-usb, balbi, Shubhrajyoti D, Kishon Vijay Abraham I

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;
 	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


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

* Re: [PATCH RFC] usb: musb: omap: fix the error check for pm_runtime_get_sync
       [not found] ` <1332400686-27674-1-git-send-email-shubhrajyoti-l0cyMroinI0@public.gmane.org>
@ 2012-03-22  8:09   ` Felipe Balbi
  0 siblings, 0 replies; 5+ messages in thread
From: Felipe Balbi @ 2012-03-22  8:09 UTC (permalink / raw)
  To: Shubhrajyoti D
  Cc: linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, balbi-l0cyMroinI0,
	Kishon Vijay Abraham I

[-- Attachment #1: Type: text/plain, Size: 528 bytes --]

On Thu, Mar 22, 2012 at 12:48:06PM +0530, Shubhrajyoti D wrote:
> 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>

applied, thanks

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [PATCH RFC] usb: musb: omap: fix the error check for pm_runtime_get_sync
  2012-03-22  7:18 [PATCH RFC] usb: musb: omap: fix the error check for pm_runtime_get_sync Shubhrajyoti D
       [not found] ` <1332400686-27674-1-git-send-email-shubhrajyoti-l0cyMroinI0@public.gmane.org>
@ 2012-03-22 12:42 ` Sergei Shtylyov
       [not found]   ` <4F6B1E2D.8020802-Igf4POYTYCDQT0dZR+AlfA@public.gmane.org>
  1 sibling, 1 reply; 5+ messages in thread
From: Sergei Shtylyov @ 2012-03-22 12:42 UTC (permalink / raw)
  To: Shubhrajyoti D; +Cc: linux-omap, linux-usb, balbi, Kishon Vijay Abraham I

Hello.

On 22-03-2012 11:18, Shubhrajyoti D wrote:

> 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

    You haven't run it thru scripts/checkpatch.pl either, I guess?

>   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
[...]
> @@ -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);

    If I don't mistake, scripts/checkpatch.pl should warn about unneeded 
spaces before '\n'. And also about missing spaces after commas.

WBR, Sergei

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

* Re: [PATCH RFC] usb: musb: omap: fix the error check for pm_runtime_get_sync
       [not found]   ` <4F6B1E2D.8020802-Igf4POYTYCDQT0dZR+AlfA@public.gmane.org>
@ 2012-03-22 12:55     ` Felipe Balbi
  2012-03-22 13:36       ` Shubhrajyoti
  0 siblings, 1 reply; 5+ messages in thread
From: Felipe Balbi @ 2012-03-22 12:55 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: Shubhrajyoti D, linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, balbi-l0cyMroinI0,
	Kishon Vijay Abraham I

[-- Attachment #1: Type: text/plain, Size: 1429 bytes --]

On Thu, Mar 22, 2012 at 04:42:21PM +0400, Sergei Shtylyov wrote:
> Hello.
> 
> On 22-03-2012 11:18, Shubhrajyoti D wrote:
> 
> >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
> 
>    You haven't run it thru scripts/checkpatch.pl either, I guess?
> 
> >  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
> [...]
> >@@ -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);
> 
>    If I don't mistake, scripts/checkpatch.pl should warn about
> unneeded spaces before '\n'. And also about missing spaces after
> commas.

I fixed in my branch, thanks

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [PATCH RFC] usb: musb: omap: fix the error check for pm_runtime_get_sync
  2012-03-22 12:55     ` Felipe Balbi
@ 2012-03-22 13:36       ` Shubhrajyoti
  0 siblings, 0 replies; 5+ messages in thread
From: Shubhrajyoti @ 2012-03-22 13:36 UTC (permalink / raw)
  To: balbi; +Cc: Sergei Shtylyov, linux-omap, linux-usb, Kishon Vijay Abraham I


>>    You haven't run it thru scripts/checkpatch.pl either, I guess?
>>

Actually modified the patch a little afterwards.
>>>  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
>> [...]
>>> @@ -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);
>>    If I don't mistake, scripts/checkpatch.pl should warn about
>> unneeded spaces before '\n'. And also about missing spaces after
>> commas.
> I fixed in my branch, thanks
>
Thanks Felipe,
Anyways resent the patch.


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

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

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-22  7:18 [PATCH RFC] usb: musb: omap: fix the error check for pm_runtime_get_sync Shubhrajyoti D
     [not found] ` <1332400686-27674-1-git-send-email-shubhrajyoti-l0cyMroinI0@public.gmane.org>
2012-03-22  8:09   ` Felipe Balbi
2012-03-22 12:42 ` Sergei Shtylyov
     [not found]   ` <4F6B1E2D.8020802-Igf4POYTYCDQT0dZR+AlfA@public.gmane.org>
2012-03-22 12:55     ` Felipe Balbi
2012-03-22 13:36       ` Shubhrajyoti

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox