diff mbox

[2/3] USB: musb: omap: Fix wrong xceivr passing to twl4030

Message ID 1252105499-19003-1-git-send-email-vikram.pandita@ti.com (mailing list archive)
State Awaiting Upstream, archived
Delegated to: Felipe Balbi
Headers show

Commit Message

vikram pandita Sept. 4, 2009, 11:04 p.m. UTC
Wrong pointer was getting passed to twl4030 transceiver.

Call path is:
otg_set_suspend -> twl4030_set_suspend

drivers/usb/otg/twl4030-usb.c: twl4030_set_suspend() uses:
	struct twl4030_usb *twl = xceiv_to_twl(x);

and xceiv_to_twl is container_of()

So the same pointer needs to be passed to otg_set_suspend() as has
been used for otg_set_transceiver.

A crash is seen without this patch, as twl pointer access is worng

Signed-off-by: Vikram Pandita <vikram.pandita@ti.com>
---
 drivers/usb/musb/omap2430.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

Comments

Ajay Kumar Gupta Sept. 8, 2009, 5:33 a.m. UTC | #1
Vikram,

> -----Original Message-----
> From: Pandita, Vikram
> Sent: Saturday, September 05, 2009 4:35 AM
> To: linux-usb@vger.kernel.org
> Cc: linux-omap@vger.kernel.org; david-b@pacbell.net; Gupta, Ajay Kumar;
> Gadiyar, Anand; felipe.balbi@nokia.com; Pandita, Vikram
> Subject: [PATCH 2/3] USB: musb: omap: Fix wrong xceivr passing to twl4030
> 
> Wrong pointer was getting passed to twl4030 transceiver.
> 
> Call path is:
> otg_set_suspend -> twl4030_set_suspend
> 
> drivers/usb/otg/twl4030-usb.c: twl4030_set_suspend() uses:
> 	struct twl4030_usb *twl = xceiv_to_twl(x);
> 
> and xceiv_to_twl is container_of()
> 
> So the same pointer needs to be passed to otg_set_suspend() as has
> been used for otg_set_transceiver.
> 
> A crash is seen without this patch, as twl pointer access is worng
> 

musb->xceiv is also taken from otg_get_transceiver() in musb_platform_init(). So this patch is not required.

-Ajay

> Signed-off-by: Vikram Pandita <vikram.pandita@ti.com>
> ---
>  drivers/usb/musb/omap2430.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
> index b957575..ea7a798 100644
> --- a/drivers/usb/musb/omap2430.c
> +++ b/drivers/usb/musb/omap2430.c
> @@ -269,7 +269,7 @@ int musb_platform_suspend(struct musb *musb)
>  	l |= ENABLEWAKEUP;	/* enable wakeup */
>  	omap_writel(l, OTG_SYSCONFIG);
> 
> -	otg_set_suspend(musb->xceiv, 1);
> +	otg_set_suspend(otg_get_transceiver(), 1);
> 
>  	if (musb->set_clock)
>  		musb->set_clock(musb->clock, 0);
> @@ -286,7 +286,7 @@ int musb_platform_resume(struct musb *musb)
>  	if (!musb->clock)
>  		return 0;
> 
> -	otg_set_suspend(musb->xceiv, 0);
> +	otg_set_suspend(otg_get_transceiver(), 0);
> 
>  	if (musb->set_clock)
>  		musb->set_clock(musb->clock, 1);
> --
> 1.6.3.3.334.g916e1

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
vikram pandita Sept. 11, 2009, 8:14 p.m. UTC | #2
Ajay

>-----Original Message-----
>From: Gupta, Ajay Kumar
>> Subject: [PATCH 2/3] USB: musb: omap: Fix wrong xceivr passing to twl4030
>>
>> Wrong pointer was getting passed to twl4030 transceiver.
>>
>> Call path is:
>> otg_set_suspend -> twl4030_set_suspend
>>
>> drivers/usb/otg/twl4030-usb.c: twl4030_set_suspend() uses:
>> 	struct twl4030_usb *twl = xceiv_to_twl(x);
>>
>> and xceiv_to_twl is container_of()
>>
>> So the same pointer needs to be passed to otg_set_suspend() as has
>> been used for otg_set_transceiver.
>>
>> A crash is seen without this patch, as twl pointer access is worng
>>
>
>musb->xceiv is also taken from otg_get_transceiver() in musb_platform_init(). So this patch is not
>required.

Thanks for pointing this out. 
I will repost a set of 2 patches with this patch removed.

Patches on their way.

>
>-Ajay
>
>> Signed-off-by: Vikram Pandita <vikram.pandita@ti.com>
>> ---
>>  drivers/usb/musb/omap2430.c |    4 ++--
>>  1 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
>> index b957575..ea7a798 100644
>> --- a/drivers/usb/musb/omap2430.c
>> +++ b/drivers/usb/musb/omap2430.c
>> @@ -269,7 +269,7 @@ int musb_platform_suspend(struct musb *musb)
>>  	l |= ENABLEWAKEUP;	/* enable wakeup */
>>  	omap_writel(l, OTG_SYSCONFIG);
>>
>> -	otg_set_suspend(musb->xceiv, 1);
>> +	otg_set_suspend(otg_get_transceiver(), 1);
>>
>>  	if (musb->set_clock)
>>  		musb->set_clock(musb->clock, 0);
>> @@ -286,7 +286,7 @@ int musb_platform_resume(struct musb *musb)
>>  	if (!musb->clock)
>>  		return 0;
>>
>> -	otg_set_suspend(musb->xceiv, 0);
>> +	otg_set_suspend(otg_get_transceiver(), 0);
>>
>>  	if (musb->set_clock)
>>  		musb->set_clock(musb->clock, 1);
>> --
>> 1.6.3.3.334.g916e1

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

Patch

diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index b957575..ea7a798 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -269,7 +269,7 @@  int musb_platform_suspend(struct musb *musb)
 	l |= ENABLEWAKEUP;	/* enable wakeup */
 	omap_writel(l, OTG_SYSCONFIG);
 
-	otg_set_suspend(musb->xceiv, 1);
+	otg_set_suspend(otg_get_transceiver(), 1);
 
 	if (musb->set_clock)
 		musb->set_clock(musb->clock, 0);
@@ -286,7 +286,7 @@  int musb_platform_resume(struct musb *musb)
 	if (!musb->clock)
 		return 0;
 
-	otg_set_suspend(musb->xceiv, 0);
+	otg_set_suspend(otg_get_transceiver(), 0);
 
 	if (musb->set_clock)
 		musb->set_clock(musb->clock, 1);