[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210916153104.13727-1-caihuoqing@baidu.com>
Date: Thu, 16 Sep 2021 23:31:03 +0800
From: Cai Huoqing <caihuoqing@...du.com>
To: <caihuoqing@...du.com>
CC: Dmitry Torokhov <dmitry.torokhov@...il.com>,
<linux-input@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: [PATCH] Input: ads7846 - Make use of the helper function dev_err_probe()
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@...du.com>
---
drivers/input/touchscreen/ads7846.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
index eaa8714ad19d..f5c053940cbf 100644
--- a/drivers/input/touchscreen/ads7846.c
+++ b/drivers/input/touchscreen/ads7846.c
@@ -1337,11 +1337,8 @@ static int ads7846_probe(struct spi_device *spi)
ads7846_setup_spi_msg(ts, pdata);
ts->reg = devm_regulator_get(dev, "vcc");
- if (IS_ERR(ts->reg)) {
- err = PTR_ERR(ts->reg);
- dev_err(dev, "unable to get regulator: %d\n", err);
- return err;
- }
+ if (IS_ERR(ts->reg))
+ return dev_err_probe(dev, PTR_ERR(ts->reg), "unable to get regulator\n");
err = regulator_enable(ts->reg);
if (err) {
--
2.25.1
Powered by blists - more mailing lists