summaryrefslogtreecommitdiff
path: root/drivers/iio/light
diff options
context:
space:
mode:
authorMaxime Roussin-Bélanger <maxime.roussinbelanger@gmail.com>2018-07-31 23:13:21 +0300
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2018-08-01 21:01:35 +0300
commit496fb59e1274086d0c67681fb1369e9941660dd9 (patch)
treef1548abc1e4d778c52fe737b122a1bde026d2e79 /drivers/iio/light
parent2b4ec22d36d46d03d01d1ec2436080d982284f36 (diff)
downloadlinux-496fb59e1274086d0c67681fb1369e9941660dd9.tar.xz
iio: light: si1133: fix uninitialized resp variable
Read response register to detect any error. Signed-off-by: Maxime Roussin-Bélanger <maxime.roussinbelanger@gmail.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/light')
-rw-r--r--drivers/iio/light/si1133.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/iio/light/si1133.c b/drivers/iio/light/si1133.c
index 5ac22c46da1f..015a21f0c2ef 100644
--- a/drivers/iio/light/si1133.c
+++ b/drivers/iio/light/si1133.c
@@ -409,6 +409,9 @@ static int si1133_command(struct si1133_data *data, u8 cmd)
err = -ETIMEDOUT;
goto out;
}
+ err = regmap_read(data->regmap, SI1133_REG_RESPONSE0, &resp);
+ if (err)
+ goto out;
} else {
err = regmap_read_poll_timeout(data->regmap,
SI1133_REG_RESPONSE0, resp,