[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240812-chipcap2-probe-improvements-v1-1-3cdff6d16897@gmail.com>
Date: Mon, 12 Aug 2024 17:43:02 +0200
From: Javier Carrasco <javier.carrasco.cruz@...il.com>
To: Jean Delvare <jdelvare@...e.com>, Guenter Roeck <linux@...ck-us.net>
Cc: linux-hwmon@...r.kernel.org, linux-kernel@...r.kernel.org,
Javier Carrasco <javier.carrasco.cruz@...il.com>
Subject: [PATCH 1/2] hwmon: chipcap2: return dev_err_probe if get regulator
fails
The error value can be directly returned via dev_err_probe(), and there
is no need to split that into two instructions.
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@...il.com>
---
drivers/hwmon/chipcap2.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/hwmon/chipcap2.c b/drivers/hwmon/chipcap2.c
index 6ccceae21f70..88689f4eb598 100644
--- a/drivers/hwmon/chipcap2.c
+++ b/drivers/hwmon/chipcap2.c
@@ -740,11 +740,9 @@ static int cc2_probe(struct i2c_client *client)
data->client = client;
data->regulator = devm_regulator_get_exclusive(dev, "vdd");
- if (IS_ERR(data->regulator)) {
- dev_err_probe(dev, PTR_ERR(data->regulator),
- "Failed to get regulator\n");
- return PTR_ERR(data->regulator);
- }
+ if (IS_ERR(data->regulator))
+ return dev_err_probe(dev, PTR_ERR(data->regulator),
+ "Failed to get regulator\n");
ret = cc2_request_ready_irq(data, dev);
if (ret) {
--
2.43.0
Powered by blists - more mailing lists