From 496fb59e1274086d0c67681fb1369e9941660dd9 Mon Sep 17 00:00:00 2001 From: Maxime Roussin-Bélanger Date: Tue, 31 Jul 2018 16:13:21 -0400 Subject: iio: light: si1133: fix uninitialized resp variable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Read response register to detect any error. Signed-off-by: Maxime Roussin-Bélanger Reported-by: Dan Carpenter Signed-off-by: Jonathan Cameron --- drivers/iio/light/si1133.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'drivers/iio') 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, -- cgit v1.2.3