Commit f41ca26b authored by Pawel Laszczak's avatar Pawel Laszczak Committed by Felipe Balbi

usb: cdns3: core: removed overwriting some error code

Some error code can be preserved, so we can remove overwriting
error code returned by some functions.
Signed-off-by: default avatarPawel Laszczak <pawell@cadence.com>
Reviewed-by: default avatarPeter Chen <peter.chen@nxp.com>
Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
parent 5c2cf30f
...@@ -347,7 +347,6 @@ static int cdns3_role_set(struct usb_role_switch *sw, enum usb_role role) ...@@ -347,7 +347,6 @@ static int cdns3_role_set(struct usb_role_switch *sw, enum usb_role role)
case USB_ROLE_HOST: case USB_ROLE_HOST:
break; break;
default: default:
ret = -EPERM;
goto pm_put; goto pm_put;
} }
} }
...@@ -358,17 +357,14 @@ static int cdns3_role_set(struct usb_role_switch *sw, enum usb_role role) ...@@ -358,17 +357,14 @@ static int cdns3_role_set(struct usb_role_switch *sw, enum usb_role role)
case USB_ROLE_DEVICE: case USB_ROLE_DEVICE:
break; break;
default: default:
ret = -EPERM;
goto pm_put; goto pm_put;
} }
} }
cdns3_role_stop(cdns); cdns3_role_stop(cdns);
ret = cdns3_role_start(cdns, role); ret = cdns3_role_start(cdns, role);
if (ret) { if (ret)
dev_err(cdns->dev, "set role %d has failed\n", role); dev_err(cdns->dev, "set role %d has failed\n", role);
ret = -EPERM;
}
pm_put: pm_put:
pm_runtime_put_sync(cdns->dev); pm_runtime_put_sync(cdns->dev);
...@@ -393,7 +389,7 @@ static int cdns3_probe(struct platform_device *pdev) ...@@ -393,7 +389,7 @@ static int cdns3_probe(struct platform_device *pdev)
ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32)); ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32));
if (ret) { if (ret) {
dev_err(dev, "error setting dma mask: %d\n", ret); dev_err(dev, "error setting dma mask: %d\n", ret);
return -ENODEV; return ret;
} }
cdns = devm_kzalloc(dev, sizeof(*cdns), GFP_KERNEL); cdns = devm_kzalloc(dev, sizeof(*cdns), GFP_KERNEL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment