Linux Hardware Monitor development
 help / color / mirror / Atom feed
From: Javier Carrasco <javier.carrasco.cruz@gmail.com>
To: Jean Delvare <jdelvare@suse.com>, Guenter Roeck <linux@roeck-us.net>
Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org,
	 Javier Carrasco <javier.carrasco.cruz@gmail.com>
Subject: [PATCH 1/2] hwmon: chipcap2: return dev_err_probe if get regulator fails
Date: Mon, 12 Aug 2024 17:43:02 +0200	[thread overview]
Message-ID: <20240812-chipcap2-probe-improvements-v1-1-3cdff6d16897@gmail.com> (raw)
In-Reply-To: <20240812-chipcap2-probe-improvements-v1-0-3cdff6d16897@gmail.com>

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@gmail.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


  reply	other threads:[~2024-08-12 15:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-12 15:43 [PATCH 0/2] hwmon: chipcap2: small improvements in probe function Javier Carrasco
2024-08-12 15:43 ` Javier Carrasco [this message]
2024-08-12 15:43 ` [PATCH 2/2] hwmon: chipcap2: disable sensor if request ready irq fails Javier Carrasco
2024-08-12 16:49   ` Guenter Roeck
2024-08-12 19:59     ` Javier Carrasco
2024-08-12 20:08       ` Guenter Roeck
2024-08-12 20:48         ` Javier Carrasco
2024-08-12 21:26           ` Guenter Roeck
2024-08-12 22:04             ` Javier Carrasco

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240812-chipcap2-probe-improvements-v1-1-3cdff6d16897@gmail.com \
    --to=javier.carrasco.cruz@gmail.com \
    --cc=jdelvare@suse.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox