diff options
author | Felipe Balbi <balbi@ti.com> | 2011-06-27 08:57:46 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-07-01 17:31:09 -0400 |
commit | e4e5b136eb6f2d3aa10dca108a1b787dc92d67df (patch) | |
tree | 17f45af2d69eed5da822b425d033b6a24af39423 /drivers | |
parent | fc0b721f27beb5464d9fb5e521f5cd68127dd14e (diff) |
usb: musb: be careful when using different fifo_modes
if we have more endpoints configured than
enabled on fifo_mode, then we need to be
careful on save/restore context operations,
otherwise we will try to access uninitialized
__iomem pointer.
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/musb/musb_core.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index c71b0372786e..b1faed7806f5 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c | |||
@@ -2214,7 +2214,16 @@ static void musb_save_context(struct musb *musb) | |||
2214 | musb->context.devctl = musb_readb(musb_base, MUSB_DEVCTL); | 2214 | musb->context.devctl = musb_readb(musb_base, MUSB_DEVCTL); |
2215 | 2215 | ||
2216 | for (i = 0; i < musb->config->num_eps; ++i) { | 2216 | for (i = 0; i < musb->config->num_eps; ++i) { |
2217 | epio = musb->endpoints[i].regs; | 2217 | struct musb_hw_ep *hw_ep; |
2218 | |||
2219 | hw_ep = &musb->endpoints[i]; | ||
2220 | if (!hw_ep) | ||
2221 | continue; | ||
2222 | |||
2223 | epio = hw_ep->regs; | ||
2224 | if (!epio) | ||
2225 | continue; | ||
2226 | |||
2218 | musb->context.index_regs[i].txmaxp = | 2227 | musb->context.index_regs[i].txmaxp = |
2219 | musb_readw(epio, MUSB_TXMAXP); | 2228 | musb_readw(epio, MUSB_TXMAXP); |
2220 | musb->context.index_regs[i].txcsr = | 2229 | musb->context.index_regs[i].txcsr = |
@@ -2280,7 +2289,16 @@ static void musb_restore_context(struct musb *musb) | |||
2280 | musb_writeb(musb_base, MUSB_DEVCTL, musb->context.devctl); | 2289 | musb_writeb(musb_base, MUSB_DEVCTL, musb->context.devctl); |
2281 | 2290 | ||
2282 | for (i = 0; i < musb->config->num_eps; ++i) { | 2291 | for (i = 0; i < musb->config->num_eps; ++i) { |
2283 | epio = musb->endpoints[i].regs; | 2292 | struct musb_hw_ep *hw_ep; |
2293 | |||
2294 | hw_ep = &musb->endpoints[i]; | ||
2295 | if (!hw_ep) | ||
2296 | continue; | ||
2297 | |||
2298 | epio = hw_ep->regs; | ||
2299 | if (!epio) | ||
2300 | continue; | ||
2301 | |||
2284 | musb_writew(epio, MUSB_TXMAXP, | 2302 | musb_writew(epio, MUSB_TXMAXP, |
2285 | musb->context.index_regs[i].txmaxp); | 2303 | musb->context.index_regs[i].txmaxp); |
2286 | musb_writew(epio, MUSB_TXCSR, | 2304 | musb_writew(epio, MUSB_TXCSR, |