diff options
author | Hartmut Knaack <knaack.h@gmx.de> | 2015-07-28 01:49:22 +0300 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2015-08-02 21:13:49 +0300 |
commit | b41e63cf83affa50a6141eba52be1fbd05f29b21 (patch) | |
tree | 4078622e67dec25ee52218e8e29f282e4dc74d26 /drivers/iio | |
parent | 946448e08e2f693ff21418d92a598b7aa296816d (diff) | |
download | linux-b41e63cf83affa50a6141eba52be1fbd05f29b21.tar.xz |
iio:accel:stk8312: check for invalid value
Revision 1.2 of the datasheet recommends on page 22 to only write non-zero
values read from OTP register 0x70 into AFECTRL register.
Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Reviewed-by: Tiberiu Breana <tiberiu.a.breana@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio')
-rw-r--r-- | drivers/iio/accel/stk8312.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/iio/accel/stk8312.c b/drivers/iio/accel/stk8312.c index a553736b6e51..8280a37e0068 100644 --- a/drivers/iio/accel/stk8312.c +++ b/drivers/iio/accel/stk8312.c @@ -150,6 +150,8 @@ static int stk8312_otp_init(struct stk8312_data *data) goto exit_err; ret = i2c_smbus_read_byte_data(client, STK8312_REG_OTPDATA); + if (ret == 0) + ret = -EINVAL; if (ret < 0) goto exit_err; |