[PATCH] usb: musb dsps: fix pdev cast in suspend/resume

Daniel Mack zonque at gmail.com
Tue Aug 13 08:40:30 EDT 2013


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




More information about the linux-arm-kernel mailing list