linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] usb: cdns3: gadget: clear trb->length as zero after preparing every trb
@ 2020-11-26  6:54 Peter Chen
  2020-11-26  6:54 ` [PATCH 2/2] usb: cdns3: core: fix goto label for error path Peter Chen
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Chen @ 2020-11-26  6:54 UTC (permalink / raw)
  To: pawell, rogerq; +Cc: balbi, linux-usb, linux-imx, frank.li, Peter Chen

From: Peter Chen <peter.chen@nxp.com>

It clears trb->length as zero before preparing td, but if scatter
buffer is used for td, there are several trbs within td, it needs to clear
every trb->length as zero, otherwise, the default value for trb->length
may not be zero after it begins to use the second round of trb rings.

Fixes: abc6b579048e ("usb: cdns3: gadget: using correct sg operations")
Signed-off-by: Peter Chen <peter.chen@nxp.com>
---
 drivers/usb/cdns3/gadget.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/cdns3/gadget.c b/drivers/usb/cdns3/gadget.c
index 365f30fb1159..0aa85cc07ff1 100644
--- a/drivers/usb/cdns3/gadget.c
+++ b/drivers/usb/cdns3/gadget.c
@@ -1260,6 +1260,7 @@ static int cdns3_ep_run_transfer(struct cdns3_endpoint *priv_ep,
 		priv_req->end_trb = priv_ep->enqueue;
 		cdns3_ep_inc_enq(priv_ep);
 		trb = priv_ep->trb_pool + priv_ep->enqueue;
+		trb->length = 0;
 	} while (sg_iter < num_trb);
 
 	trb = priv_req->trb;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] usb: cdns3: core: fix goto label for error path
  2020-11-26  6:54 [PATCH 1/2] usb: cdns3: gadget: clear trb->length as zero after preparing every trb Peter Chen
@ 2020-11-26  6:54 ` Peter Chen
  2020-11-26 10:13   ` Sergei Shtylyov
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Chen @ 2020-11-26  6:54 UTC (permalink / raw)
  To: pawell, rogerq; +Cc: balbi, linux-usb, linux-imx, frank.li, Peter Chen

From: Peter Chen <peter.chen@nxp.com>

The usb_role_switch_register has already called, so if the devm_request_irq
has failed, it needs to call usb_role_switch_unregister.

Fixes: b1234e3b3b26 ("usb: cdns3: add runtime PM support")
Signed-off-by: Peter Chen <peter.chen@nxp.com>
---
 drivers/usb/cdns3/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/cdns3/core.c b/drivers/usb/cdns3/core.c
index 170deb3eacf0..039ab5d2435e 100644
--- a/drivers/usb/cdns3/core.c
+++ b/drivers/usb/cdns3/core.c
@@ -553,7 +553,7 @@ static int cdns3_probe(struct platform_device *pdev)
 
 		if (ret) {
 			dev_err(cdns->dev, "couldn't register wakeup irq handler\n");
-			goto err3;
+			goto err4;
 		}
 	}
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] usb: cdns3: core: fix goto label for error path
  2020-11-26  6:54 ` [PATCH 2/2] usb: cdns3: core: fix goto label for error path Peter Chen
@ 2020-11-26 10:13   ` Sergei Shtylyov
  2020-11-27  6:48     ` Peter Chen
  0 siblings, 1 reply; 4+ messages in thread
From: Sergei Shtylyov @ 2020-11-26 10:13 UTC (permalink / raw)
  To: Peter Chen, pawell, rogerq
  Cc: balbi, linux-usb, linux-imx, frank.li, Peter Chen

Hello!

On 26.11.2020 9:54, Peter Chen wrote:

> From: Peter Chen <peter.chen@nxp.com>
> 
> The usb_role_switch_register has already called, so if the devm_request_irq
                                   ^ been

> has failed, it needs to call usb_role_switch_unregister.
> 
> Fixes: b1234e3b3b26 ("usb: cdns3: add runtime PM support")
> Signed-off-by: Peter Chen <peter.chen@nxp.com>
[...]

MBR, Sergei

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] usb: cdns3: core: fix goto label for error path
  2020-11-26 10:13   ` Sergei Shtylyov
@ 2020-11-27  6:48     ` Peter Chen
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Chen @ 2020-11-27  6:48 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: Peter Chen, pawell@cadence.com, rogerq@ti.com, balbi@kernel.org,
	linux-usb@vger.kernel.org, dl-linux-imx, Frank Li

On 20-11-26 13:13:16, Sergei Shtylyov wrote:
> Hello!
> 
> On 26.11.2020 9:54, Peter Chen wrote:
> 
> > From: Peter Chen <peter.chen@nxp.com>
> > 
> > The usb_role_switch_register has already called, so if the devm_request_irq
>                                   ^ been
> 

Thanks, will fix it.

> > has failed, it needs to call usb_role_switch_unregister.
> > 
> > Fixes: b1234e3b3b26 ("usb: cdns3: add runtime PM support")
> > Signed-off-by: Peter Chen <peter.chen@nxp.com>
> [...]
> 
> MBR, Sergei

-- 

Thanks,
Peter Chen

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-11-27  6:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-26  6:54 [PATCH 1/2] usb: cdns3: gadget: clear trb->length as zero after preparing every trb Peter Chen
2020-11-26  6:54 ` [PATCH 2/2] usb: cdns3: core: fix goto label for error path Peter Chen
2020-11-26 10:13   ` Sergei Shtylyov
2020-11-27  6:48     ` Peter Chen

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).