mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jianqiang Tang <jianqiang.tang@intel.com>
To: John Youn <johnyoun@synopsys.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, "Tang,
	Jianqiang" <jianqiang.tang@intel.com>,
	Dyson Lee <dyson.lee@intel.com>
Subject: [PATCH] usb: dwc2: host: fix the data toggle error in full speed descriptor dma
Date: Tue, 26 Jan 2016 14:17:00 +0800	[thread overview]
Message-ID: <1453789020-9271-1-git-send-email-jianqiang.tang@intel.com> (raw)

From: "Tang, Jianqiang" <jianqiang.tang@intel.com>

There will be data toggle error happen for full speed buld-out transfer.
The data toggle bit is saved in qh for non-control transfers, it is wrong
to  check the qtd for that case.

Also fix one static analysis tool issue after fix the data toggle error.

Signed-off-by: Dyson Lee <dyson.lee@intel.com>
Signed-off-by: Tang, Jianqiang <jianqiang.tang@intel.com>
---
 drivers/usb/dwc2/hcd_ddma.c | 2 +-
 drivers/usb/dwc2/hcd_intr.c | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/dwc2/hcd_ddma.c b/drivers/usb/dwc2/hcd_ddma.c
index 36606fc..6b18956 100644
--- a/drivers/usb/dwc2/hcd_ddma.c
+++ b/drivers/usb/dwc2/hcd_ddma.c
@@ -1258,7 +1258,7 @@ static void dwc2_complete_non_isoc_xfer_ddma(struct dwc2_hsotg *hsotg,
 		 */
 		if (halt_status == DWC2_HC_XFER_STALL)
 			qh->data_toggle = DWC2_HC_PID_DATA0;
-		else if (qtd)
+		else
 			dwc2_hcd_save_data_toggle(hsotg, chan, chnum, qtd);
 	}
 
diff --git a/drivers/usb/dwc2/hcd_intr.c b/drivers/usb/dwc2/hcd_intr.c
index f825380..918773f 100644
--- a/drivers/usb/dwc2/hcd_intr.c
+++ b/drivers/usb/dwc2/hcd_intr.c
@@ -530,6 +530,10 @@ void dwc2_hcd_save_data_toggle(struct dwc2_hsotg *hsotg,
 		else
 			chan->qh->data_toggle = DWC2_HC_PID_DATA1;
 	} else {
+		if (!qtd) {
+			dev_err(hsotg->dev, "qtd is null, return\n");
+			return;
+		}
 		if (pid == TSIZ_SC_MC_PID_DATA0)
 			qtd->data_toggle = DWC2_HC_PID_DATA0;
 		else
-- 
1.9.1

             reply	other threads:[~2016-01-26  6:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-26  6:17 Jianqiang Tang [this message]
2016-02-16  1:35 ` John Youn

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=1453789020-9271-1-git-send-email-jianqiang.tang@intel.com \
    --to=jianqiang.tang@intel.com \
    --cc=dyson.lee@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=johnyoun@synopsys.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.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

all inboxes | Powered by JetHome®