diff options
author | Anson Huang <Anson.Huang@nxp.com> | 2020-08-11 09:24:32 +0300 |
---|---|---|
committer | Thierry Reding <thierry.reding@gmail.com> | 2020-12-17 16:18:47 +0300 |
commit | f1332e9294158d8969a9bf51f01e0d1b3b844f15 (patch) | |
tree | 885f597d4dc8d795314686279749e923c5f64c5f /drivers/pwm/pwm-imx1.c | |
parent | d109d74c4cda019653f8f31d3030d8ff28caa994 (diff) | |
download | linux-f1332e9294158d8969a9bf51f01e0d1b3b844f15.tar.xz |
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>
Diffstat (limited to 'drivers/pwm/pwm-imx1.c')
-rw-r--r-- | drivers/pwm/pwm-imx1.c | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/drivers/pwm/pwm-imx1.c b/drivers/pwm/pwm-imx1.c index 1a60bfd7d659..727e0d3e249e 100644 --- a/drivers/pwm/pwm-imx1.c +++ b/drivers/pwm/pwm-imx1.c @@ -144,23 +144,14 @@ static int pwm_imx1_probe(struct platform_device *pdev) platform_set_drvdata(pdev, imx); imx->clk_ipg = devm_clk_get(&pdev->dev, "ipg"); - if (IS_ERR(imx->clk_ipg)) { - dev_err(&pdev->dev, "getting ipg clock failed with %ld\n", - PTR_ERR(imx->clk_ipg)); - return PTR_ERR(imx->clk_ipg); - } + if (IS_ERR(imx->clk_ipg)) + return dev_err_probe(&pdev->dev, PTR_ERR(imx->clk_ipg), + "getting ipg clock failed\n"); imx->clk_per = devm_clk_get(&pdev->dev, "per"); - if (IS_ERR(imx->clk_per)) { - int ret = PTR_ERR(imx->clk_per); - - if (ret != -EPROBE_DEFER) - dev_err(&pdev->dev, - "failed to get peripheral clock: %d\n", - ret); - - return ret; - } + if (IS_ERR(imx->clk_per)) + return dev_err_probe(&pdev->dev, PTR_ERR(imx->clk_per), + "failed to get peripheral clock\n"); imx->chip.ops = &pwm_imx1_ops; imx->chip.dev = &pdev->dev; |