summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2019-04-10 19:23:51 +0100
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2019-04-14 13:50:09 +0100
commit8e4fefec0174b43fd149dee159131c88cb623664 (patch)
tree304d64578cc742e8438782a6a313172cd55f5e8f
parent631bd2f7ec02ad9e3d1fa31765971387e7792483 (diff)
downloadlinux-8e4fefec0174b43fd149dee159131c88cb623664.tar.bz2
iio: temperature: max31856: fix uninitialized error return
Currently if mask is neither CHAN_INFO_RAW or CHAN_INFO_SCALE then then an uninitialized error return 'ret' is returned. Fix this by adding a default case that ensures -EINVAL is returned for this specific case. Addresses-Coverity: ("Uninitialized scalar variable") Signed-off-by: Colin Ian King <colin.king@canonical.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-rw-r--r--drivers/iio/temperature/max31856.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/iio/temperature/max31856.c b/drivers/iio/temperature/max31856.c
index 6b67d6b95cf9..f184ba5601d9 100644
--- a/drivers/iio/temperature/max31856.c
+++ b/drivers/iio/temperature/max31856.c
@@ -210,6 +210,9 @@ static int max31856_read_raw(struct iio_dev *indio_dev,
return IIO_VAL_INT_PLUS_MICRO;
}
break;
+ default:
+ ret = -EINVAL;
+ break;
}
return ret;