summaryrefslogtreecommitdiff
path: root/recipes/linux/linux-omap-pm/fix-musb-oops.diff
diff options
context:
space:
mode:
Diffstat (limited to 'recipes/linux/linux-omap-pm/fix-musb-oops.diff')
-rw-r--r--recipes/linux/linux-omap-pm/fix-musb-oops.diff60
1 files changed, 60 insertions, 0 deletions
diff --git a/recipes/linux/linux-omap-pm/fix-musb-oops.diff b/recipes/linux/linux-omap-pm/fix-musb-oops.diff
new file mode 100644
index 0000000000..788e7be5a8
--- /dev/null
+++ b/recipes/linux/linux-omap-pm/fix-musb-oops.diff
@@ -0,0 +1,60 @@
+From patchwork Mon Jun 29 09:06:48 2009
+Content-Type: text/plain; charset="utf-8"
+MIME-Version: 1.0
+Content-Transfer-Encoding: 7bit
+Subject: [v2] usb: musb: Warn and check for OTG transceiver misconfiguration
+Date: Mon, 29 Jun 2009 09:06:48 -0000
+From: Roger Quadros <ext-roger.quadros@nokia.com>
+X-Patchwork-Id: 32914
+
+Warn if OTG is selected in Kconfig but not initialized by platform code.
+Add checks to prevent NULL pointer exception in case the
+OTG transceiver has not been initialized. i.e. musb->xceiv == NULL
+
+Signed-off-by: Roger Quadros <ext-roger.quadros@nokia.com>
+Tested-by: Paul Walmsley <paul@pwsan.com>
+
+---
+drivers/usb/musb/musb_core.c | 7 ++++++-
+ drivers/usb/musb/omap2430.c | 3 ++-
+ 2 files changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
+index 554a414..d0cfc22 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
+@@ -1958,6 +1959,10 @@ bad_config:
+ musb->isr = generic_interrupt;
+ status = musb_platform_init(musb);
+
++#ifdef CONFIG_USB_MUSB_OTG
++ if (!musb->xceiv)
++ WARN(1, "MUSB: OTG transceiver not set up correctly\n");
++#endif
+ if (status < 0)
+ goto fail;
+ if (!musb->isr) {
+diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
+index 3487520..8987d60 100644
+--- a/drivers/usb/musb/omap2430.c
++++ b/drivers/usb/musb/omap2430.c
+@@ -271,7 +271,8 @@ int musb_platform_suspend(struct musb *musb)
+ l |= ENABLEWAKEUP; /* enable wakeup */
+ omap_writel(l, OTG_SYSCONFIG);
+
+- otg_set_suspend(musb->xceiv, 1);
++ if (musb->xceiv)
++ otg_set_suspend(musb->xceiv, 1);
+
+ if (musb->set_clock)
+ musb->set_clock(musb->clock, 0);