Skip to contentSkip to conversation

iio: light: si1133: fix uninitialized resp variable

PATCH Applied Maxime Roussin-Bélanger 2 participants 2 messages Jul 31, 2018 – Aug 1, 2018 IIO

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 iio: light: si1133: fix uninitialized resp variable

Read response register to detect any error.

---
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
index d3fbeb3bc463..9b8862af0127 100644
@@ -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
maintainer Applied
#1 lore raw
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

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
=20

 drivers/iio/light/si1133.c | 3 +++
 1 file changed, 3 insertions(+)

=20

drivers/iio/light/si1133.c +0 -0
index d3fbeb3bc463..9b8862af0127 100644
@@ -409,6 +409,9 @@ static int si1133_command(struct si1133_data *data, u=

8 cmd)

Quoted 9 lines
drivers/iio/light/si1133.c +3 -0
 			err =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,