drivers: bus: imx-weim: Simplify error path
Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
This commit is contained in:
parent
70ac98da78
commit
b2d1fb7332
1 changed files with 8 additions and 14 deletions
|
@ -78,36 +78,30 @@ static int weim_probe(struct platform_device *pdev)
|
||||||
struct resource *res;
|
struct resource *res;
|
||||||
struct clk *clk;
|
struct clk *clk;
|
||||||
void __iomem *base;
|
void __iomem *base;
|
||||||
int ret = -EINVAL;
|
int ret;
|
||||||
|
|
||||||
/* get the resource */
|
/* get the resource */
|
||||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||||
base = devm_ioremap_resource(&pdev->dev, res);
|
base = devm_ioremap_resource(&pdev->dev, res);
|
||||||
if (IS_ERR(base)) {
|
if (IS_ERR(base))
|
||||||
ret = PTR_ERR(base);
|
return PTR_ERR(base);
|
||||||
goto weim_err;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* get the clock */
|
/* get the clock */
|
||||||
clk = devm_clk_get(&pdev->dev, NULL);
|
clk = devm_clk_get(&pdev->dev, NULL);
|
||||||
if (IS_ERR(clk))
|
if (IS_ERR(clk))
|
||||||
goto weim_err;
|
return PTR_ERR(clk);
|
||||||
|
|
||||||
ret = clk_prepare_enable(clk);
|
ret = clk_prepare_enable(clk);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto weim_err;
|
return ret;
|
||||||
|
|
||||||
/* parse the device node */
|
/* parse the device node */
|
||||||
ret = weim_parse_dt(pdev, base);
|
ret = weim_parse_dt(pdev, base);
|
||||||
if (ret) {
|
if (ret)
|
||||||
clk_disable_unprepare(clk);
|
clk_disable_unprepare(clk);
|
||||||
goto weim_err;
|
else
|
||||||
}
|
dev_info(&pdev->dev, "Driver registered.\n");
|
||||||
|
|
||||||
dev_info(&pdev->dev, "WEIM driver registered.\n");
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
weim_err:
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue