diff options
author | Sakethram Bommisetti <sakethram.bommisetti@stericsson.com> | 2011-10-03 16:23:44 +0530 |
---|---|---|
committer | Srinidhi KASAGAR <srinidhi.kasagar@stericsson.com> | 2011-10-04 10:27:48 +0200 |
commit | 24fa0d7bd177f2dc42fc20e4cc5452d6a0a0d2e4 (patch) | |
tree | 3537cfb932c4e7623465ab11e009fd6c67327ca3 | |
parent | 7c38070d6bb7325a1a4c73c9f86d8b0f6b092792 (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 1c260ec113b..ef89af12bbf 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); |