[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20210916153219.14257-1-caihuoqing@baidu.com>
Date: Thu, 16 Sep 2021 23:32:18 +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: drv2667 - 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/misc/drv2667.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/input/misc/drv2667.c b/drivers/input/misc/drv2667.c
index 3f67b9b010bf..06d98fe426a6 100644
--- a/drivers/input/misc/drv2667.c
+++ b/drivers/input/misc/drv2667.c
@@ -344,12 +344,9 @@ static int drv2667_probe(struct i2c_client *client,
return -ENOMEM;
haptics->regulator = devm_regulator_get(&client->dev, "vbat");
- if (IS_ERR(haptics->regulator)) {
- error = PTR_ERR(haptics->regulator);
- dev_err(&client->dev,
- "unable to get regulator, error: %d\n", error);
- return error;
- }
+ if (IS_ERR(haptics->regulator))
+ return dev_err_probe(&client->dev, PTR_ERR(haptics->regulator),
+ "unable to get regulator\n");
haptics->input_dev = devm_input_allocate_device(&client->dev);
if (!haptics->input_dev) {
--
2.25.1
Powered by blists - more mailing lists