Message ID | 20200701062004.29908-9-pawell@cadence.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | usb: cdns3: Improvements for cdns3 DRD code | expand |
On 20-07-01 08:20:03, Pawel Laszczak wrote: > Some error code can be preserved, so we can remove overwriting > error code returned by some functions. Improve the patch title, otherwise: Reviewed-by: Peter Chen <peter.chen@nxp.com> Peter > > Signed-off-by: Pawel Laszczak <pawell@cadence.com> > --- > drivers/usb/cdns3/core.c | 8 ++------ > 1 file changed, 2 insertions(+), 6 deletions(-) > > diff --git a/drivers/usb/cdns3/core.c b/drivers/usb/cdns3/core.c > index 591186987245..01155ab73930 100644 > --- a/drivers/usb/cdns3/core.c > +++ b/drivers/usb/cdns3/core.c > @@ -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; > } > } > @@ -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); > @@ -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); > -- > 2.17.1 >
diff --git a/drivers/usb/cdns3/core.c b/drivers/usb/cdns3/core.c index 591186987245..01155ab73930 100644 --- a/drivers/usb/cdns3/core.c +++ b/drivers/usb/cdns3/core.c @@ -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; } } @@ -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); @@ -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);
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> --- drivers/usb/cdns3/core.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)