alistair23-linux/drivers/staging/iio/meter
Arnd Bergmann 7e1da86339 iio: ade7753: avoid uninitialized data
The ade7753_spi_read_reg_16() will either successfully read a value
from SPI, or return a failure code without delivering data. However,
the ade7753_stop_device() and ade7753_reset() functions use the returned
data without checking for an error condition first. Gcc detects this
as a possible bug and warns about it:

drivers/staging/iio/meter/ade7753.c: In function 'ade7753_remove':
drivers/staging/iio/meter/ade7753.c:348:6: error: 'val' may be used uninitialized in this function [-Werror=maybe-uninitialized]
  val |= BIT(4);  /* AD converters can be turned off */
      ^
drivers/staging/iio/meter/ade7753.c:345:6: note: 'val' was declared here
  u16 val;
      ^
drivers/staging/iio/meter/ade7753.c: In function 'ade7753_probe':
drivers/staging/iio/meter/ade7753.c:222:6: error: 'val' may be used uninitialized in this function [-Werror=maybe-uninitialized]

In both cases, we can avoids the warning by checking the return code
before using the data.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-01-30 16:24:24 +00:00
..
ade7753.c iio: ade7753: avoid uninitialized data 2016-01-30 16:24:24 +00:00
ade7753.h
ade7754.c spi: Updates for v4.4 2015-11-05 13:15:12 -08:00
ade7754.h
ade7758.h
ade7758_core.c spi: Updates for v4.4 2015-11-05 13:15:12 -08:00
ade7758_ring.c
ade7758_trigger.c
ade7759.c spi: Updates for v4.4 2015-11-05 13:15:12 -08:00
ade7759.h
ade7854-i2c.c
ade7854-spi.c spi: Updates for v4.4 2015-11-05 13:15:12 -08:00
ade7854.c
ade7854.h
Kconfig
Makefile
meter.h