All of lore.kernel.org
 help / color / mirror / Atom feed
From: Li Zhong <floridsleeves@gmail.com>
To: linux-hwmon@vger.kernel.org
Cc: linux@roeck-us.net, jdelvare@suse.com,
	Li Zhong <floridsleeves@gmail.com>
Subject: [PATCH v1] drivers: adt7470: check the return value of adt7470_read_temperatures
Date: Wed, 21 Sep 2022 15:27:48 -0700	[thread overview]
Message-ID: <20220921222748.1667190-1-floridsleeves@gmail.com> (raw)

adt7470_read_temperatures() fails and returns error when operations on
regmap fail. adt7470_update_thread() currently does not check for it and
propagate the error.

Signed-off-by: Li Zhong <floridsleeves@gmail.com>
---
 drivers/hwmon/adt7470.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/hwmon/adt7470.c b/drivers/hwmon/adt7470.c
index c67cd037a93f..0aadb2dc067f 100644
--- a/drivers/hwmon/adt7470.c
+++ b/drivers/hwmon/adt7470.c
@@ -289,12 +289,16 @@ static int adt7470_update_thread(void *p)
 {
 	struct i2c_client *client = p;
 	struct adt7470_data *data = i2c_get_clientdata(client);
+	int err;
 
 	while (!kthread_should_stop()) {
 		mutex_lock(&data->lock);
-		adt7470_read_temperatures(data);
+		err = adt7470_read_temperatures(data);
 		mutex_unlock(&data->lock);
 
+		if (err)
+			return err;
+
 		if (kthread_should_stop())
 			break;
 
-- 
2.25.1


             reply	other threads:[~2022-09-21 22:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-21 22:27 Li Zhong [this message]
2022-09-21 22:48 ` [PATCH v1] drivers: adt7470: check the return value of adt7470_read_temperatures Guenter Roeck

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=20220921222748.1667190-1-floridsleeves@gmail.com \
    --to=floridsleeves@gmail.com \
    --cc=jdelvare@suse.com \
    --cc=linux-hwmon@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.