staging: iio: ad5933: avoid uninitialized variable in error case
authorArnd Bergmann <arnd@arndb.de>
Mon, 24 Oct 2016 15:22:01 +0000 (17:22 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 25 Oct 2016 09:04:17 +0000 (11:04 +0200)
commitb8fd7220752fe10f6df3755ce40aa0a9acd2c6be
treea6a13b81f250efde78556a516fef3c9bf9a4b7a3
parentfb26718744c46f34fb9b8cdf5f73030548978b49
staging: iio: ad5933: avoid uninitialized variable in error case

The ad5933_i2c_read function returns an error code to indicate
whether it could read data or not. However ad5933_work() ignores
this return code and just accesses the data unconditionally,
which gets detected by gcc as a possible bug:

drivers/staging/iio/impedance-analyzer/ad5933.c: In function 'ad5933_work':
drivers/staging/iio/impedance-analyzer/ad5933.c:649:16: warning: 'status' may be used uninitialized in this function [-Wmaybe-uninitialized]

This adds minimal error handling so we only evaluate the
data if it was correctly read.

Link: https://patchwork.kernel.org/patch/8110281/
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/iio/impedance-analyzer/ad5933.c