diff options
author | Sakethram Bommisetti <sakethram.bommisetti@stericsson.com> | 2011-10-03 16:23:44 +0530 |
---|---|---|
committer | Philippe Langlais <philippe.langlais@stericsson.com> | 2012-05-22 11:03:12 +0200 |
commit | 64d32b4540bd292f12c3e492709dd09475da4811 (patch) | |
tree | 5bd5891a454ca238bef534a09d8d345771bb04df | |
parent | 9d4c65b12c05826f8380d6ed80b96a0b7b484b41 (diff) |
ux500:USB: Handling the null pointer situation
Connect and boot can cause a NULL pointer access if link status interrupt
comes before we enable the MUSB platform initialization happens.
ST-Ericsson Linux next: NA
ST-Ericsson ID: 365151
ST-Ericsson FOSS-OUT ID: NA
Signed-off-by: Sakethram Bommisetti <sakethram.bommisetti@stericsson.com>
Change-Id: I91aaa269913a7fdf5b4f59927dd563cf8c456e4f
Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/32825
Reviewed-by: Praveena NADAHALLY <praveen.nadahally@stericsson.com>
Reviewed-by: Srinidhi KASAGAR <srinidhi.kasagar@stericsson.com>
-rw-r--r-- | drivers/usb/musb/ux500.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/drivers/usb/musb/ux500.c b/drivers/usb/musb/ux500.c index 8872393be94..f0ce8ac3cf4 100644 --- a/drivers/usb/musb/ux500.c +++ b/drivers/usb/musb/ux500.c @@ -46,9 +46,15 @@ void ux500_store_context(struct musb *musb) { #ifdef CONFIG_PM int i; - void __iomem *musb_base = musb->mregs; + void __iomem *musb_base; void __iomem *epio; - _musb = musb; + + if (musb != NULL) + _musb = musb; + else + return; + + musb_base = musb->mregs; if (is_host_enabled(musb)) { context.frame = musb_readw(musb_base, MUSB_FRAME); @@ -112,11 +118,17 @@ void ux500_restore_context(void) { #ifdef CONFIG_PM int i; - struct musb *musb = _musb; - void __iomem *musb_base = musb->mregs; + struct musb *musb; + void __iomem *musb_base; void __iomem *ep_target_regs; void __iomem *epio; + if (_musb != NULL) + musb = _musb; + else + return; + + musb_base = musb->mregs; if (is_host_enabled(musb)) { musb_writew(musb_base, MUSB_FRAME, context.frame); musb_writeb(musb_base, MUSB_TESTMODE, context.testmode); |