[PATCH] Input: imx6ul_tsc - Make use of the helper function dev_err_probe()

Cai Huoqing caihuoqing at baidu.com
Thu Sep 16 08:32:40 PDT 2021


When possible use dev_err_probe help to properly deal with the
PROBE_DEFER error, the benefit is that DEFER issue will be logged
in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value
gets printed.

Signed-off-by: Cai Huoqing <caihuoqing at baidu.com>
---
 drivers/input/touchscreen/imx6ul_tsc.c | 25 +++++++++----------------
 1 file changed, 9 insertions(+), 16 deletions(-)

diff --git a/drivers/input/touchscreen/imx6ul_tsc.c b/drivers/input/touchscreen/imx6ul_tsc.c
index 2d4facf70cdb..47b73b4008ab 100644
--- a/drivers/input/touchscreen/imx6ul_tsc.c
+++ b/drivers/input/touchscreen/imx6ul_tsc.c
@@ -405,12 +405,9 @@ static int imx6ul_tsc_probe(struct platform_device *pdev)
 	init_completion(&tsc->completion);
 
 	tsc->xnur_gpio = devm_gpiod_get(&pdev->dev, "xnur", GPIOD_IN);
-	if (IS_ERR(tsc->xnur_gpio)) {
-		err = PTR_ERR(tsc->xnur_gpio);
-		dev_err(&pdev->dev,
-			"failed to request GPIO tsc_X- (xnur): %d\n", err);
-		return err;
-	}
+	if (IS_ERR(tsc->xnur_gpio))
+		return dev_err_probe(&pdev->dev, PTR_ERR(tsc->xnur_gpio),
+				     "failed to request GPIO tsc_X- (xnur)\n");
 
 	tsc->tsc_regs = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(tsc->tsc_regs)) {
@@ -427,18 +424,14 @@ static int imx6ul_tsc_probe(struct platform_device *pdev)
 	}
 
 	tsc->tsc_clk = devm_clk_get(&pdev->dev, "tsc");
-	if (IS_ERR(tsc->tsc_clk)) {
-		err = PTR_ERR(tsc->tsc_clk);
-		dev_err(&pdev->dev, "failed getting tsc clock: %d\n", err);
-		return err;
-	}
+	if (IS_ERR(tsc->tsc_clk))
+		return dev_err_probe(&pdev->dev, PTR_ERR(tsc->tsc_clk),
+				     "failed getting tsc clock\n");
 
 	tsc->adc_clk = devm_clk_get(&pdev->dev, "adc");
-	if (IS_ERR(tsc->adc_clk)) {
-		err = PTR_ERR(tsc->adc_clk);
-		dev_err(&pdev->dev, "failed getting adc clock: %d\n", err);
-		return err;
-	}
+	if (IS_ERR(tsc->adc_clk))
+		return dev_err_probe(&pdev->dev, PTR_ERR(tsc->adc_clk),
+				     "failed getting adc clock\n");
 
 	tsc_irq = platform_get_irq(pdev, 0);
 	if (tsc_irq < 0)
-- 
2.25.1




More information about the linux-arm-kernel mailing list