mirror of
https://github.com/torvalds/linux.git
synced 2024-11-02 10:11:36 +00:00
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>
This commit is contained in:
parent
946448e08e
commit
b41e63cf83
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user