diff mbox series

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

Message ID 20180731201321.17178-1-maxime.roussinbelanger@gmail.com (mailing list archive)
State New, archived
Headers show
Series [v2] iio: light: si1133: fix uninitialized resp variable | expand

Commit Message

Maxime Roussin-Bélanger July 31, 2018, 8:13 p.m. UTC
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>
---
Changes in v2:
	- Added missing signed-off-by

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

Comments

Jonathan Cameron Aug. 1, 2018, 6:02 p.m. UTC | #1
On Tue, 31 Jul 2018 16:13:21 -0400
Maxime Roussin-Bélanger <maxime.roussinbelanger@gmail.com> wrote:

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

> ---
> 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,

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

Patch

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,