]> git.baikalelectronics.ru Git - kernel.git/commit
iio: as3935: improve error reporting in as3935_event_work
authorArnd Bergmann <arnd@arndb.de>
Mon, 30 May 2016 14:52:04 +0000 (16:52 +0200)
committerJonathan Cameron <jic23@kernel.org>
Mon, 27 Jun 2016 19:59:10 +0000 (20:59 +0100)
commit877c814f1f4824fb5c4db98b20b31605d97211ae
tree88ed54fdd9333135d44cf5dc0ebce6e3fa7cf512
parentd97f86e19bc2c0bc7a50c23dbf9a5b304ceae2e2
iio: as3935: improve error reporting in as3935_event_work

gcc warns about a potentially uninitialized variable use
in as3935_event_work:

drivers/iio/proximity/as3935.c: In function ‘as3935_event_work’:
drivers/iio/proximity/as3935.c:231:6: error: ‘val’ may be used uninitialized in this function [-Werror=maybe-uninitialized]

This case specifically happens when spi_w8r8() fails with a
negative return code. We check all other users of this function
except this one.

As the error is rather unlikely to happen after the device
has already been initialized, this just adds a dev_warn().
Another warning already exists in the same function, but is
missing a trailing '\n' character, so I'm fixing that too.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Matt Ranostay <mranostay@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/proximity/as3935.c