linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: mpa@pengutronix.de (Markus Pargmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 1/3] usb: musb: Handle nullpointer
Date: Mon, 14 Oct 2013 15:50:37 +0200	[thread overview]
Message-ID: <1381758639-30300-2-git-send-email-mpa@pengutronix.de> (raw)
In-Reply-To: <1381758639-30300-1-git-send-email-mpa@pengutronix.de>

When the device is connected to a host without a gadget driver,
otg->gadget is NULL.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
---
 drivers/usb/musb/musb_core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 18e877f..baa4f6a 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -654,7 +654,8 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
 				break;
 		case OTG_STATE_B_PERIPHERAL:
 			musb_g_suspend(musb);
-			musb->is_active = otg->gadget->b_hnp_enable;
+			musb->is_active = otg->gadget &&
+					otg->gadget->b_hnp_enable;
 			if (musb->is_active) {
 				musb->xceiv->state = OTG_STATE_B_WAIT_ACON;
 				dev_dbg(musb->controller, "HNP: Setting timer for b_ase0_brst\n");
-- 
1.8.4.rc3

  reply	other threads:[~2013-10-14 13:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-14 13:50 [PATCH v2 0/3] usb: musb bugfixes Markus Pargmann
2013-10-14 13:50 ` Markus Pargmann [this message]
2013-10-14 22:49   ` [PATCH v2 1/3] usb: musb: Handle nullpointer Felipe Balbi
2013-10-15  1:56     ` Bin Liu
2013-10-15  2:00       ` Bin Liu
2013-10-15  3:07         ` Felipe Balbi
2013-10-14 13:50 ` [PATCH v2 2/3] usb: musb: Bugfix of_node assignment Markus Pargmann
2013-10-14 13:50 ` [PATCH v2 3/3] usb: musb: dsps, debugfs files Markus Pargmann
2013-10-14 22:50   ` Felipe Balbi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1381758639-30300-2-git-send-email-mpa@pengutronix.de \
    --to=mpa@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).