aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelipe Balbi <balbi@ti.com>2014-02-25 11:58:43 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-05-06 10:55:33 -0400
commit6b32172a1d3cffa74067ced96612bd13658d4fcf (patch)
treedf90f386ef3fed3a0ae2192330c4bae225ff6d5e
parent0bf463e6229ba7d2da00acb72e0a25bce9447696 (diff)
usb: musb: avoid NULL pointer dereference
commit eee3f15d5f1f4f0c283dd4db67dc1b874a2852d1 upstream. instead of relying on the otg pointer, which can be NULL in certain cases, we can use the gadget and host pointers we already hold inside struct musb. Tested-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/musb/musb_core.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 37a261a6bb6a..da0caf3f4b27 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -440,7 +440,6 @@ void musb_hnp_stop(struct musb *musb)
440static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb, 440static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
441 u8 devctl) 441 u8 devctl)
442{ 442{
443 struct usb_otg *otg = musb->xceiv->otg;
444 irqreturn_t handled = IRQ_NONE; 443 irqreturn_t handled = IRQ_NONE;
445 444
446 dev_dbg(musb->controller, "<== DevCtl=%02x, int_usb=0x%x\n", devctl, 445 dev_dbg(musb->controller, "<== DevCtl=%02x, int_usb=0x%x\n", devctl,
@@ -655,7 +654,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
655 break; 654 break;
656 case OTG_STATE_B_PERIPHERAL: 655 case OTG_STATE_B_PERIPHERAL:
657 musb_g_suspend(musb); 656 musb_g_suspend(musb);
658 musb->is_active = otg->gadget->b_hnp_enable; 657 musb->is_active = musb->g.b_hnp_enable;
659 if (musb->is_active) { 658 if (musb->is_active) {
660 musb->xceiv->state = OTG_STATE_B_WAIT_ACON; 659 musb->xceiv->state = OTG_STATE_B_WAIT_ACON;
661 dev_dbg(musb->controller, "HNP: Setting timer for b_ase0_brst\n"); 660 dev_dbg(musb->controller, "HNP: Setting timer for b_ase0_brst\n");
@@ -671,7 +670,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
671 break; 670 break;
672 case OTG_STATE_A_HOST: 671 case OTG_STATE_A_HOST:
673 musb->xceiv->state = OTG_STATE_A_SUSPEND; 672 musb->xceiv->state = OTG_STATE_A_SUSPEND;
674 musb->is_active = otg->host->b_hnp_enable; 673 musb->is_active = musb_to_hcd(musb)->self.b_hnp_enable;
675 break; 674 break;
676 case OTG_STATE_B_HOST: 675 case OTG_STATE_B_HOST:
677 /* Transition to B_PERIPHERAL, see 6.8.2.6 p 44 */ 676 /* Transition to B_PERIPHERAL, see 6.8.2.6 p 44 */