drivers: adt7470: check the return value of adt7470_read_temperatures
PATCH 1/1 drivers: adt7470: check the return value of adt7470_read_temperatures
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 <[email protected]>
--- drivers/hwmon/adt7470.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/hwmon/adt7470.c +5 -1
@@ -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 ;
Signature · 1 line
2.25.1
Quoted 21 lines · Li Zhong
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 <[email protected]>--- drivers/hwmon/adt7470.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)drivers/hwmon/adt7470.c +1
-0@@ -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);
drivers/hwmon/adt7470.c static int adt7470_update_thread(void *p) · line 304
Quoted 10 lines
drivers/hwmon/adt7470.c +4
-1-adt7470_read_temperatures (data); + err =adt7470_read_temperatures (data);mutex_unlock (&data->lock); +if (err) +return err; +if (kthread_should_stop ())break ;
NACK.
That is a kernel thread which should keep going even after an error. Aborting the thread after an error would be the absolute wrong thing to do.
Guenter