Commit 5327f34b authored by Krzysztof Kozlowski's avatar Krzysztof Kozlowski Committed by Thierry Reding

pwm: sun4i: Simplify with dev_err_probe()

Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and also it prints the error value.
Signed-off-by: default avatarKrzysztof Kozlowski <krzk@kernel.org>
Acked-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: default avatarThierry Reding <thierry.reding@gmail.com>
parent 793bb636
...@@ -423,38 +423,26 @@ static int sun4i_pwm_probe(struct platform_device *pdev) ...@@ -423,38 +423,26 @@ static int sun4i_pwm_probe(struct platform_device *pdev)
* back to the first clock of the PWM. * back to the first clock of the PWM.
*/ */
pwm->clk = devm_clk_get_optional(&pdev->dev, "mod"); pwm->clk = devm_clk_get_optional(&pdev->dev, "mod");
if (IS_ERR(pwm->clk)) { if (IS_ERR(pwm->clk))
if (PTR_ERR(pwm->clk) != -EPROBE_DEFER) return dev_err_probe(&pdev->dev, PTR_ERR(pwm->clk),
dev_err(&pdev->dev, "get mod clock failed %pe\n", "get mod clock failed\n");
pwm->clk);
return PTR_ERR(pwm->clk);
}
if (!pwm->clk) { if (!pwm->clk) {
pwm->clk = devm_clk_get(&pdev->dev, NULL); pwm->clk = devm_clk_get(&pdev->dev, NULL);
if (IS_ERR(pwm->clk)) { if (IS_ERR(pwm->clk))
if (PTR_ERR(pwm->clk) != -EPROBE_DEFER) return dev_err_probe(&pdev->dev, PTR_ERR(pwm->clk),
dev_err(&pdev->dev, "get unnamed clock failed %pe\n", "get unnamed clock failed\n");
pwm->clk);
return PTR_ERR(pwm->clk);
}
} }
pwm->bus_clk = devm_clk_get_optional(&pdev->dev, "bus"); pwm->bus_clk = devm_clk_get_optional(&pdev->dev, "bus");
if (IS_ERR(pwm->bus_clk)) { if (IS_ERR(pwm->bus_clk))
if (PTR_ERR(pwm->bus_clk) != -EPROBE_DEFER) return dev_err_probe(&pdev->dev, PTR_ERR(pwm->bus_clk),
dev_err(&pdev->dev, "get bus clock failed %pe\n", "get bus clock failed\n");
pwm->bus_clk);
return PTR_ERR(pwm->bus_clk);
}
pwm->rst = devm_reset_control_get_optional_shared(&pdev->dev, NULL); pwm->rst = devm_reset_control_get_optional_shared(&pdev->dev, NULL);
if (IS_ERR(pwm->rst)) { if (IS_ERR(pwm->rst))
if (PTR_ERR(pwm->rst) != -EPROBE_DEFER) return dev_err_probe(&pdev->dev, PTR_ERR(pwm->rst),
dev_err(&pdev->dev, "get reset failed %pe\n", "get reset failed\n");
pwm->rst);
return PTR_ERR(pwm->rst);
}
/* Deassert reset */ /* Deassert reset */
ret = reset_control_deassert(pwm->rst); ret = reset_control_deassert(pwm->rst);
......
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