Commit 168cc329 authored by Anson Huang's avatar Anson Huang Committed by Thierry Reding

pwm: imx-tpm: 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: default avatarAnson Huang <Anson.Huang@nxp.com>
Acked-by: default avatarLee Jones <lee.jones@linaro.org>
Acked-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: default avatarThierry Reding <thierry.reding@gmail.com>
parent accef074
......@@ -350,13 +350,9 @@ static int pwm_imx_tpm_probe(struct platform_device *pdev)
return PTR_ERR(tpm->base);
tpm->clk = devm_clk_get(&pdev->dev, NULL);
if (IS_ERR(tpm->clk)) {
ret = PTR_ERR(tpm->clk);
if (ret != -EPROBE_DEFER)
dev_err(&pdev->dev,
"failed to get PWM clock: %d\n", ret);
return ret;
}
if (IS_ERR(tpm->clk))
return dev_err_probe(&pdev->dev, PTR_ERR(tpm->clk),
"failed to get PWM clock\n");
ret = clk_prepare_enable(tpm->clk);
if (ret) {
......
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