Skip to content

Commit

Permalink
usb: cdns3: core: removed overwriting some error code
Browse files Browse the repository at this point in the history
Some error code can be preserved, so we can remove overwriting
error code returned by some functions.

Signed-off-by: Pawel Laszczak <pawell@cadence.com>
Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
  • Loading branch information
Pawel Laszczak authored and Felipe Balbi committed Jul 24, 2020
1 parent 5c2cf30 commit f41ca26
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions drivers/usb/cdns3/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,6 @@ static int cdns3_role_set(struct usb_role_switch *sw, enum usb_role role)
case USB_ROLE_HOST:
break;
default:
ret = -EPERM;
goto pm_put;
}
}
Expand All @@ -358,17 +357,14 @@ static int cdns3_role_set(struct usb_role_switch *sw, enum usb_role role)
case USB_ROLE_DEVICE:
break;
default:
ret = -EPERM;
goto pm_put;
}
}

cdns3_role_stop(cdns);
ret = cdns3_role_start(cdns, role);
if (ret) {
if (ret)
dev_err(cdns->dev, "set role %d has failed\n", role);
ret = -EPERM;
}

pm_put:
pm_runtime_put_sync(cdns->dev);
Expand All @@ -393,7 +389,7 @@ static int cdns3_probe(struct platform_device *pdev)
ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32));
if (ret) {
dev_err(dev, "error setting dma mask: %d\n", ret);
return -ENODEV;
return ret;
}

cdns = devm_kzalloc(dev, sizeof(*cdns), GFP_KERNEL);
Expand Down

0 comments on commit f41ca26

Please sign in to comment.