* [patch] iio: light: apds9960: silence uninitialized variable warning
@ 2016-04-22 10:04 Dan Carpenter
2016-04-23 21:18 ` Jonathan Cameron
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2016-04-22 10:04 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler,
Matt Ranostay, linux-iio, linux-kernel, kernel-janitors
It causes a static checker warning if we use "buf" on the failure path
so move that inside the if statement.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/iio/light/apds9960.c b/drivers/iio/light/apds9960.c
index a6af56a..fbdd172 100644
--- a/drivers/iio/light/apds9960.c
+++ b/drivers/iio/light/apds9960.c
@@ -491,9 +491,10 @@ static int apds9960_read_raw(struct iio_dev *indio_dev,
case IIO_INTENSITY:
ret = regmap_bulk_read(data->regmap, chan->address,
&buf, 2);
- if (!ret)
+ if (!ret) {
ret = IIO_VAL_INT;
- *val = le16_to_cpu(buf);
+ *val = le16_to_cpu(buf);
+ }
break;
default:
ret = -EINVAL;
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [patch] iio: light: apds9960: silence uninitialized variable warning
2016-04-22 10:04 [patch] iio: light: apds9960: silence uninitialized variable warning Dan Carpenter
@ 2016-04-23 21:18 ` Jonathan Cameron
0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2016-04-23 21:18 UTC (permalink / raw)
To: Dan Carpenter
Cc: Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler,
Matt Ranostay, linux-iio, linux-kernel, kernel-janitors
On 22/04/16 11:04, Dan Carpenter wrote:
> It causes a static checker warning if we use "buf" on the failure path
> so move that inside the if statement.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Applied to the togreg branch of iio.git,
Thanks,
Jonathan
>
> diff --git a/drivers/iio/light/apds9960.c b/drivers/iio/light/apds9960.c
> index a6af56a..fbdd172 100644
> --- a/drivers/iio/light/apds9960.c
> +++ b/drivers/iio/light/apds9960.c
> @@ -491,9 +491,10 @@ static int apds9960_read_raw(struct iio_dev *indio_dev,
> case IIO_INTENSITY:
> ret = regmap_bulk_read(data->regmap, chan->address,
> &buf, 2);
> - if (!ret)
> + if (!ret) {
> ret = IIO_VAL_INT;
> - *val = le16_to_cpu(buf);
> + *val = le16_to_cpu(buf);
> + }
> break;
> default:
> ret = -EINVAL;
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-04-23 21:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-22 10:04 [patch] iio: light: apds9960: silence uninitialized variable warning Dan Carpenter
2016-04-23 21:18 ` Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).