* [PATCH] usb: musb dsps: fix pdev cast in suspend/resume
@ 2013-08-13 12:40 Daniel Mack
2013-08-13 15:37 ` Felipe Balbi
2013-08-21 8:50 ` Daniel Mack
0 siblings, 2 replies; 4+ messages in thread
From: Daniel Mack @ 2013-08-13 12:40 UTC (permalink / raw)
To: linux-arm-kernel
dsps_suspend() and dsps_resume() are called with the device that has the
glue assigned as drvdata. Using dev->parent seems wrong and causes a
NULL pointer exception on an AM33xx board.
The code was introduced by commit c68bb4c6 ("usb: musb: dsps: control
module handling (quirk)") but I wonder whether it was ever used.
Signed-off-by: Daniel Mack <zonque@gmail.com>
---
drivers/usb/musb/musb_dsps.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index 5233804..f20218e 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -692,7 +692,7 @@ static int dsps_remove(struct platform_device *pdev)
#ifdef CONFIG_PM_SLEEP
static int dsps_suspend(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev->parent);
+ struct platform_device *pdev = to_platform_device(dev);
struct dsps_glue *glue = platform_get_drvdata(pdev);
const struct dsps_musb_wrapper *wrp = glue->wrp;
int i;
@@ -705,7 +705,7 @@ static int dsps_suspend(struct device *dev)
static int dsps_resume(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev->parent);
+ struct platform_device *pdev = to_platform_device(dev);
struct dsps_glue *glue = platform_get_drvdata(pdev);
const struct dsps_musb_wrapper *wrp = glue->wrp;
int i;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] usb: musb dsps: fix pdev cast in suspend/resume
2013-08-13 12:40 [PATCH] usb: musb dsps: fix pdev cast in suspend/resume Daniel Mack
@ 2013-08-13 15:37 ` Felipe Balbi
2013-08-13 15:45 ` Daniel Mack
2013-08-21 8:50 ` Daniel Mack
1 sibling, 1 reply; 4+ messages in thread
From: Felipe Balbi @ 2013-08-13 15:37 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Aug 13, 2013 at 02:40:30PM +0200, Daniel Mack wrote:
> dsps_suspend() and dsps_resume() are called with the device that has the
> glue assigned as drvdata. Using dev->parent seems wrong and causes a
> NULL pointer exception on an AM33xx board.
>
> The code was introduced by commit c68bb4c6 ("usb: musb: dsps: control
> module handling (quirk)") but I wonder whether it was ever used.
>
> Signed-off-by: Daniel Mack <zonque@gmail.com>
> ---
> drivers/usb/musb/musb_dsps.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
> index 5233804..f20218e 100644
> --- a/drivers/usb/musb/musb_dsps.c
> +++ b/drivers/usb/musb/musb_dsps.c
> @@ -692,7 +692,7 @@ static int dsps_remove(struct platform_device *pdev)
> #ifdef CONFIG_PM_SLEEP
> static int dsps_suspend(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev->parent);
> + struct platform_device *pdev = to_platform_device(dev);
> struct dsps_glue *glue = platform_get_drvdata(pdev);
actually, can you get rid of the platform_device access here ? The
following should work:
struct dsps_glue *glue = dev_get_drvdata(dev);
--
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130813/498c8e60/attachment-0001.sig>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] usb: musb dsps: fix pdev cast in suspend/resume
2013-08-13 15:37 ` Felipe Balbi
@ 2013-08-13 15:45 ` Daniel Mack
0 siblings, 0 replies; 4+ messages in thread
From: Daniel Mack @ 2013-08-13 15:45 UTC (permalink / raw)
To: linux-arm-kernel
On 13.08.2013 17:37, Felipe Balbi wrote:
> On Tue, Aug 13, 2013 at 02:40:30PM +0200, Daniel Mack wrote:
>> diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
>> index 5233804..f20218e 100644
>> --- a/drivers/usb/musb/musb_dsps.c
>> +++ b/drivers/usb/musb/musb_dsps.c
>> @@ -692,7 +692,7 @@ static int dsps_remove(struct platform_device *pdev)
>> #ifdef CONFIG_PM_SLEEP
>> static int dsps_suspend(struct device *dev)
>> {
>> - struct platform_device *pdev = to_platform_device(dev->parent);
>> + struct platform_device *pdev = to_platform_device(dev);
>> struct dsps_glue *glue = platform_get_drvdata(pdev);
>
> actually, can you get rid of the platform_device access here ? The
> following should work:
>
> struct dsps_glue *glue = dev_get_drvdata(dev);
>
Right, thank you Felipe. I just sent out v2.
Daniel
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] usb: musb dsps: fix pdev cast in suspend/resume
2013-08-13 12:40 [PATCH] usb: musb dsps: fix pdev cast in suspend/resume Daniel Mack
2013-08-13 15:37 ` Felipe Balbi
@ 2013-08-21 8:50 ` Daniel Mack
1 sibling, 0 replies; 4+ messages in thread
From: Daniel Mack @ 2013-08-21 8:50 UTC (permalink / raw)
To: linux-arm-kernel
On 13.08.2013 14:40, Daniel Mack wrote:
> dsps_suspend() and dsps_resume() are called with the device that has the
> glue assigned as drvdata. Using dev->parent seems wrong and causes a
> NULL pointer exception on an AM33xx board.
>
> The code was introduced by commit c68bb4c6 ("usb: musb: dsps: control
> module handling (quirk)") but I wonder whether it was ever used.
>
> Signed-off-by: Daniel Mack <zonque@gmail.com>
Felipe, is this one good to go in?
Thanks,
Daniel
> ---
> drivers/usb/musb/musb_dsps.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
> index 5233804..f20218e 100644
> --- a/drivers/usb/musb/musb_dsps.c
> +++ b/drivers/usb/musb/musb_dsps.c
> @@ -692,7 +692,7 @@ static int dsps_remove(struct platform_device *pdev)
> #ifdef CONFIG_PM_SLEEP
> static int dsps_suspend(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev->parent);
> + struct platform_device *pdev = to_platform_device(dev);
> struct dsps_glue *glue = platform_get_drvdata(pdev);
> const struct dsps_musb_wrapper *wrp = glue->wrp;
> int i;
> @@ -705,7 +705,7 @@ static int dsps_suspend(struct device *dev)
>
> static int dsps_resume(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev->parent);
> + struct platform_device *pdev = to_platform_device(dev);
> struct dsps_glue *glue = platform_get_drvdata(pdev);
> const struct dsps_musb_wrapper *wrp = glue->wrp;
> int i;
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-08-21 8:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-13 12:40 [PATCH] usb: musb dsps: fix pdev cast in suspend/resume Daniel Mack
2013-08-13 15:37 ` Felipe Balbi
2013-08-13 15:45 ` Daniel Mack
2013-08-21 8:50 ` Daniel Mack
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).