Commit e4e5b136 authored by Felipe Balbi's avatar Felipe Balbi Committed by Greg Kroah-Hartman

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: default avatarFelipe Balbi <balbi@ti.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent fc0b721f
...@@ -2214,7 +2214,16 @@ static void musb_save_context(struct musb *musb) ...@@ -2214,7 +2214,16 @@ static void musb_save_context(struct musb *musb)
musb->context.devctl = musb_readb(musb_base, MUSB_DEVCTL); musb->context.devctl = musb_readb(musb_base, MUSB_DEVCTL);
for (i = 0; i < musb->config->num_eps; ++i) { for (i = 0; i < musb->config->num_eps; ++i) {
epio = musb->endpoints[i].regs; struct musb_hw_ep *hw_ep;
hw_ep = &musb->endpoints[i];
if (!hw_ep)
continue;
epio = hw_ep->regs;
if (!epio)
continue;
musb->context.index_regs[i].txmaxp = musb->context.index_regs[i].txmaxp =
musb_readw(epio, MUSB_TXMAXP); musb_readw(epio, MUSB_TXMAXP);
musb->context.index_regs[i].txcsr = musb->context.index_regs[i].txcsr =
...@@ -2280,7 +2289,16 @@ static void musb_restore_context(struct musb *musb) ...@@ -2280,7 +2289,16 @@ static void musb_restore_context(struct musb *musb)
musb_writeb(musb_base, MUSB_DEVCTL, musb->context.devctl); musb_writeb(musb_base, MUSB_DEVCTL, musb->context.devctl);
for (i = 0; i < musb->config->num_eps; ++i) { for (i = 0; i < musb->config->num_eps; ++i) {
epio = musb->endpoints[i].regs; struct musb_hw_ep *hw_ep;
hw_ep = &musb->endpoints[i];
if (!hw_ep)
continue;
epio = hw_ep->regs;
if (!epio)
continue;
musb_writew(epio, MUSB_TXMAXP, musb_writew(epio, MUSB_TXMAXP,
musb->context.index_regs[i].txmaxp); musb->context.index_regs[i].txmaxp);
musb_writew(epio, MUSB_TXCSR, musb_writew(epio, MUSB_TXCSR,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment