iio: scd4x: check return of scd4x_write_and_fetch
authorTom Rix <trix@redhat.com>
Tue, 1 Mar 2022 02:52:23 +0000 (18:52 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 9 May 2022 07:16:12 +0000 (09:16 +0200)
commit3ea6c6cc9811c864e2a353b69b4ed25807acee2f
tree7eb4ac9b8eee798627f43449911fd38522f89345
parent7462f0c79762d60ea26c9aabdb600c797f81c10b
iio: scd4x: check return of scd4x_write_and_fetch

commit f50232193e61cf89a73130b5e843fef30763c428 upstream.

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.

Fixes: 49d22b695cbb ("drivers: iio: chemical: Add support for Sensirion SCD4x CO2 sensor")
Signed-off-by: Tom Rix <trix@redhat.com>
Link: https://lore.kernel.org/r/20220301025223.223223-1-trix@redhat.com
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/iio/chemical/scd4x.c