pwm: imx-tpm: Use dev_err_probe() to simplify error handling
Subsystems (2)
PATCH RESEND v2 1/3 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.
---
changes since V1:
- remove redundant return value print.
--- drivers/pwm/pwm-imx-tpm.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/pwm/pwm-imx-tpm.c +3 -7
@@ -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) {
Signature · 1 line
2.7.4
PATCH RESEND v2 2/3 pwm: imx27: 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.
---
changes since V1:
- remove redundant return value print.
--- drivers/pwm/pwm-imx27.c | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-)
drivers/pwm/pwm-imx27.c +6 -19
@@ -315,27 +315,14 @@ static int pwm_imx27_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)) { -int ret =PTR_ERR (imx->clk_ipg); - -if (ret != -EPROBE_DEFER ) -dev_err (&pdev->dev, -"getting ipg clock failed with %d\n" , - ret); -return ret; - } +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_imx27_ops; imx->chip.dev = &pdev->dev;
Signature · 1 line
2.7.4
PATCH RESEND v2 3/3 pwm: imx1: Use dev_err_probe() to simplify error handling
In reply to Anson Huangdev_err_probe() can reduce code size, uniform error handling and record the defer probe reason etc., use it to simplify the code.
---
changes since V1:
- remove redundant return value print.
--- drivers/pwm/pwm-imx1.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-)
drivers/pwm/pwm-imx1.c +6 -15
@@ -145,23 +145,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;
Signature · 1 line
2.7.4