mirror of
https://github.com/torvalds/linux.git
synced 2024-11-23 20:51:44 +00:00
pwm: imx1: Use dev_err_probe() to simplify error handling
dev_err_probe() can reduce code size, uniform error handling and record the defer probe reason etc., use it to simplify the code. Signed-off-by: Anson Huang <Anson.Huang@nxp.com> Acked-by: Lee Jones <lee.jones@linaro.org> Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
This commit is contained in:
parent
d109d74c4c
commit
f1332e9294
@ -144,23 +144,14 @@ static int pwm_imx1_probe(struct platform_device *pdev)
|
|||||||
platform_set_drvdata(pdev, imx);
|
platform_set_drvdata(pdev, imx);
|
||||||
|
|
||||||
imx->clk_ipg = devm_clk_get(&pdev->dev, "ipg");
|
imx->clk_ipg = devm_clk_get(&pdev->dev, "ipg");
|
||||||
if (IS_ERR(imx->clk_ipg)) {
|
if (IS_ERR(imx->clk_ipg))
|
||||||
dev_err(&pdev->dev, "getting ipg clock failed with %ld\n",
|
return dev_err_probe(&pdev->dev, PTR_ERR(imx->clk_ipg),
|
||||||
PTR_ERR(imx->clk_ipg));
|
"getting ipg clock failed\n");
|
||||||
return PTR_ERR(imx->clk_ipg);
|
|
||||||
}
|
|
||||||
|
|
||||||
imx->clk_per = devm_clk_get(&pdev->dev, "per");
|
imx->clk_per = devm_clk_get(&pdev->dev, "per");
|
||||||
if (IS_ERR(imx->clk_per)) {
|
if (IS_ERR(imx->clk_per))
|
||||||
int ret = PTR_ERR(imx->clk_per);
|
return dev_err_probe(&pdev->dev, PTR_ERR(imx->clk_per),
|
||||||
|
"failed to get peripheral clock\n");
|
||||||
if (ret != -EPROBE_DEFER)
|
|
||||||
dev_err(&pdev->dev,
|
|
||||||
"failed to get peripheral clock: %d\n",
|
|
||||||
ret);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
imx->chip.ops = &pwm_imx1_ops;
|
imx->chip.ops = &pwm_imx1_ops;
|
||||||
imx->chip.dev = &pdev->dev;
|
imx->chip.dev = &pdev->dev;
|
||||||
|
Loading…
Reference in New Issue
Block a user