Felipe Balbi wrote:
Hi,
On Fri, Jun 26, 2009 at 02:47:17PM +0200, Quadros Roger (EXT-Teleca/Helsinki) wrote:
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@xxxxxxxxx>
---
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)
this doesn't even pass checkpatch.pl and I guess the best would be to
force on Kconfig users to select a transceiver when using OTG support of
musb.
Even if we force transceiver selection in Kconfig, it is possible that the board
files do not declare the OTG transceiver (e.g. the current rx51 board files) and
hence otg_set_transceiver() is never called. This will lead to a kernel crash at
musb_free() and musb_platform_exit(). IMHO we should check for NULL pointers anyway.
I will resend the patch with formatting fixes.
-roger
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html