All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: musb: Check for NULL pointers when no OTG transceiver used
@ 2009-06-26 13:23 Roger Quadros
  0 siblings, 0 replies; only message in thread
From: Roger Quadros @ 2009-06-26 13:23 UTC (permalink / raw)
  To: linux-omap

Add checks to prevent NULL pointer exception in case no
OTG transceiver has been selected. i.e. musb->xceiv == NULL

Signed-off-by: Roger Quadros <ext-roger.quadros@nokia.com>
---
 drivers/usb/musb/musb_core.c |    3 ++-
 drivers/usb/musb/omap2430.c  |    7 +++++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 554a414..2dd6fa9 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -1861,7 +1861,8 @@ static void musb_free(struct musb *musb)
 	}
 
 #ifdef CONFIG_USB_MUSB_OTG
-	put_device(musb->xceiv->dev);
+	if(musb->xceiv)
+		put_device(musb->xceiv->dev);
 #endif
 
 #ifdef CONFIG_USB_MUSB_HDRC_HCD
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index 3487520..3eb8d1c 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -312,9 +312,12 @@ int musb_platform_exit(struct musb *musb)
 
 	omap_vbus_power(musb, 0 /*off*/, 1);
 
-	musb_platform_suspend(musb);
+	if(musb->xceiv)
+		musb_platform_suspend(musb);
+
+	if(musb->clock)
+		clk_put(musb->clock);
 
-	clk_put(musb->clock);
 	musb->clock = 0;
 
 	return 0;
-- 
1.6.0.4


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2009-06-26 13:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-26 13:23 [PATCH] usb: musb: Check for NULL pointers when no OTG transceiver used Roger Quadros

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.