iio: light: si1133: fix uninitialized resp variable
PATCH v2 1/1 iio: light: si1133: fix uninitialized resp variable
Read response register to detect any error.
Signed-off-by Maxime Roussin-Bélanger <[email protected]>
Reported-by Dan Carpenter <[email protected]>
---
Changes in v2:
- Added missing signed-off-by
drivers/iio/light/si1133.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/iio/light/si1133.c +3 -0
@@ -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,
Signature · 1 line
2.18.0
Quoted 3 lines · On Tue, 31 Jul 2018 16:13:21 -0400 Maxime Roussin-B=C3=A9langer…
Read response register to detect any error.
=20
.com>
Quoted 1 line
Reported-by Dan Carpenter <[email protected]>
Thanks. Given the announced delay in the merge window opening I'm going to make an optimistic pull request and this just snuck in.
Applied to the togreg branch of iio.git.
Thanks,
Jonathan
drivers/iio/light/si1133.c static int si1133_command(struct si1133_data *data, u=
Quoted 12 lines
---
Changes in v2:
- Added missing signed-off-by
=20drivers/iio/light/si1133.c | 3 +++ 1 file changed, 3 insertions(+)=20
drivers/iio/light/si1133.c +0
-0@@ -409,6 +409,9 @@ static int si1133_command(struct si1133_data *data, u=
8 cmd)
Quoted 9 lines
drivers/iio/light/si1133.c +3
-0err =3D -ETIMEDOUT ; goto out; } + err =3D regmap_read(data->regmap, SI1133_REG_RESPONSE0, &resp); +if (err) + goto out; }else { err =3D regmap_read_poll_timeout(data->regmap, SI1133_REG_RESPONSE0, resp,