[PATCH 1/2] hwmon: chipcap2: return dev_err_probe if get regulator fails
From: Javier Carrasco
Date: Mon Aug 12 2024 - 11:43:49 EST
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@xxxxxxxxx>
---
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