[PATCH v2] iio: light: si1133: fix uninitialized resp variable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Read response register to detect any error.

Signed-off-by: Maxime Roussin-Bélanger <maxime.roussinbelanger@xxxxxxxxx>
Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
---
Changes in v2:
	- Added missing signed-off-by

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

diff --git a/drivers/iio/light/si1133.c b/drivers/iio/light/si1133.c
index d3fbeb3bc463..9b8862af0127 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,
-- 
2.18.0

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux