diff options
author | Arnd Bergmann <arnd@arndb.de> | 2016-10-18 00:13:35 +0200 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2016-10-23 22:18:45 +0100 |
commit | 64bc2d02d754f4143d65cc21c644176db12ab5c8 (patch) | |
tree | af7290a712163984fb3aca7b30df78334c1167e1 /Documentation | |
parent | d1fe85ec7702917f2f1515b4c421d5d4792201a0 (diff) |
iio: accel: sca3000_core: avoid potentially uninitialized variable
The newly added __sca3000_get_base_freq function handles all valid
modes of the SCA3000_REG_ADDR_MODE register, but gcc notices
that any other value (i.e. 0x00) causes the base_freq variable to
not get initialized:
drivers/staging/iio/accel/sca3000_core.c: In function 'sca3000_write_raw':
drivers/staging/iio/accel/sca3000_core.c:527:23: error: 'base_freq' may be used uninitialized in this function [-Werror=maybe-uninitialized]
This adds explicit error handling for unexpected register values,
to ensure this cannot happen.
Fixes: e0f3fc9b47e6 ("iio: accel: sca3000_core: implemented IIO_CHAN_INFO_SAMP_FREQ")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Ico Doornekamp <ico@pruts.nl>
Cc: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'Documentation')