WSL2-Linux-Kernel/drivers/iio/temperature
Arnd Bergmann d70674eeaa iio: maxim_thermocouple: detect invalid storage size in read()
As found by gcc -Wmaybe-uninitialized, having a storage_bytes value other
than 2 or 4 will result in undefined behavior:

drivers/iio/temperature/maxim_thermocouple.c: In function 'maxim_thermocouple_read':
drivers/iio/temperature/maxim_thermocouple.c:141:5: error: 'ret' may be used uninitialized in this function [-Werror=maybe-uninitialized]

This probably cannot happen, but returning -EINVAL here is appropriate
and makes gcc happy and the code more robust.

Fixes: 231147ee77 ("iio: maxim_thermocouple: Align 16 bit big endian value of raw reads")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
(cherry picked from commit 32cb7d27e6)
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-11-13 10:08:32 +01:00
..
Kconfig iio: temperature: add Kconfig selects for triggered buffer 2016-08-21 19:50:44 +01:00
Makefile iio: temperature: add support for Maxim thermocouple chips 2016-07-10 14:44:03 +01:00
maxim_thermocouple.c iio: maxim_thermocouple: detect invalid storage size in read() 2016-11-13 10:08:32 +01:00
mlx90614.c iio: convert to common i2c_check_functionality() return value 2016-02-27 17:17:43 +00:00
tmp006.c iio: convert to common i2c_check_functionality() return value 2016-02-27 17:17:43 +00:00
tsys01.c iio: convert to common i2c_check_functionality() return value 2016-02-27 17:17:43 +00:00
tsys02d.c iio: Export I2C module alias information 2016-05-21 20:08:14 +01:00