patch "iio: scd4x: check return of scd4x_write_and_fetch" added to char-misc-linus
Subsystems (3)
This is a note to let you know that I've just added the patch titled
iio: scd4x: check return of scd4x_write_and_fetch
to my char-misc git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
in the char-misc-linus branch.
The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)
The patch will hopefully also be merged in Linus's tree for the next -rc kernel release.
If you have any questions about this process, please let me know.
From f50232193e61cf89a73130b5e843fef30763c428 Mon Sep 17 00:00:00 2001
From: Tom Rix <[email protected]>
Date: Mon, 28 Feb 2022 18:52:23 -0800
Subject: iio: scd4x: check return of scd4x_write_and_fetch
Clang static analysis reports this problem scd4x.c:474:10: warning: The left operand of '==' is a
garbage value
if (val == 0xff) {
~~~ ^val is only set from a successful call to scd4x_write_and_fetch() So check it's return.
--- drivers/iio/chemical/scd4x.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/iio/chemical/scd4x.c +4 -1
@@ -471,12 +471,15 @@ static ssize_t calibration_forced_value_store(struct device *dev, ret =scd4x_write_and_fetch (state,CMD_FRC , arg, &val,sizeof (val));mutex_unlock (&state->lock); +if (ret) +return ret; +if (val ==0xff ) {dev_err (dev,"forced calibration has failed" );return -EINVAL ; } -return ret ?: len; +return len; } static IIO_DEVICE_ATTR_RW(calibration_auto_enable, 0);
Signature · 1 line
2.36.0