Skip to content

Commit 7cc01c4

Browse files
committed
Merge tag 'usb-fixes-v5.10-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/peter.chen/usb into usb-linus
Peter writes: - Fixed hardware role switch issue at TI platform - Fixed scatter-list buffer handling - Fixed error goto label issue * tag 'usb-fixes-v5.10-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/peter.chen/usb: usb: cdns3: core: fix goto label for error path usb: cdns3: gadget: clear trb->length as zero after preparing every trb usb: cdns3: Fix hardware based role switch
2 parents b650545 + 6b81375 commit 7cc01c4

2 files changed

Lines changed: 17 additions & 13 deletions

File tree

drivers/usb/cdns3/core.c

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,6 @@ static irqreturn_t cdns3_wakeup_irq(int irq, void *data)
427427
*/
428428
static int cdns3_probe(struct platform_device *pdev)
429429
{
430-
struct usb_role_switch_desc sw_desc = { };
431430
struct device *dev = &pdev->dev;
432431
struct resource *res;
433432
struct cdns3 *cdns;
@@ -529,18 +528,21 @@ static int cdns3_probe(struct platform_device *pdev)
529528
if (ret)
530529
goto err2;
531530

532-
sw_desc.set = cdns3_role_set;
533-
sw_desc.get = cdns3_role_get;
534-
sw_desc.allow_userspace_control = true;
535-
sw_desc.driver_data = cdns;
536-
if (device_property_read_bool(dev, "usb-role-switch"))
531+
if (device_property_read_bool(dev, "usb-role-switch")) {
532+
struct usb_role_switch_desc sw_desc = { };
533+
534+
sw_desc.set = cdns3_role_set;
535+
sw_desc.get = cdns3_role_get;
536+
sw_desc.allow_userspace_control = true;
537+
sw_desc.driver_data = cdns;
537538
sw_desc.fwnode = dev->fwnode;
538539

539-
cdns->role_sw = usb_role_switch_register(dev, &sw_desc);
540-
if (IS_ERR(cdns->role_sw)) {
541-
ret = PTR_ERR(cdns->role_sw);
542-
dev_warn(dev, "Unable to register Role Switch\n");
543-
goto err3;
540+
cdns->role_sw = usb_role_switch_register(dev, &sw_desc);
541+
if (IS_ERR(cdns->role_sw)) {
542+
ret = PTR_ERR(cdns->role_sw);
543+
dev_warn(dev, "Unable to register Role Switch\n");
544+
goto err3;
545+
}
544546
}
545547

546548
if (cdns->wakeup_irq) {
@@ -551,7 +553,7 @@ static int cdns3_probe(struct platform_device *pdev)
551553

552554
if (ret) {
553555
dev_err(cdns->dev, "couldn't register wakeup irq handler\n");
554-
goto err3;
556+
goto err4;
555557
}
556558
}
557559

@@ -582,7 +584,8 @@ static int cdns3_probe(struct platform_device *pdev)
582584
return 0;
583585
err4:
584586
cdns3_drd_exit(cdns);
585-
usb_role_switch_unregister(cdns->role_sw);
587+
if (cdns->role_sw)
588+
usb_role_switch_unregister(cdns->role_sw);
586589
err3:
587590
set_phy_power_off(cdns);
588591
err2:

drivers/usb/cdns3/gadget.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1260,6 +1260,7 @@ static int cdns3_ep_run_transfer(struct cdns3_endpoint *priv_ep,
12601260
priv_req->end_trb = priv_ep->enqueue;
12611261
cdns3_ep_inc_enq(priv_ep);
12621262
trb = priv_ep->trb_pool + priv_ep->enqueue;
1263+
trb->length = 0;
12631264
} while (sg_iter < num_trb);
12641265

12651266
trb = priv_req->trb;

0 commit comments

Comments
 (0)