2020-02-07 09:13:21

by Guido Günther

[permalink] [raw]
Subject: [PATCH] iio: vncl4000: Fix early return in vcnl4200_set_power_state

Don't return early unconditionally.

Signed-off-by: Guido Günther <[email protected]>
Reported-by: kbuild test robot <[email protected]>
Reported-by: Dan Carpenter <[email protected]>

---
I've not added a 'Fixes:' line since this is not part of Linus tree yet.
Tested proximity and ambient light on a vcnl4040 and checked the driver
suspends/resumes correctly and puts out valid data right after resume.

drivers/iio/light/vcnl4000.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/light/vcnl4000.c b/drivers/iio/light/vcnl4000.c
index 3b71c7d538af..38fcd9a26046 100644
--- a/drivers/iio/light/vcnl4000.c
+++ b/drivers/iio/light/vcnl4000.c
@@ -149,7 +149,7 @@ static int vcnl4200_set_power_state(struct vcnl4000_data *data, bool on)
if (ret < 0)
return ret;

- return i2c_smbus_write_word_data(data->client, VCNL4200_PS_CONF1, val);
+ ret = i2c_smbus_write_word_data(data->client, VCNL4200_PS_CONF1, val);
if (ret < 0)
return ret;

--
2.23.0


2020-02-07 19:46:37

by Matt Ranostay

[permalink] [raw]
Subject: Re: [PATCH] iio: vncl4000: Fix early return in vcnl4200_set_power_state

On Fri, Feb 7, 2020 at 1:12 AM Guido Günther <[email protected]> wrote:
>
> Don't return early unconditionally.
>
> Signed-off-by: Guido Günther <[email protected]>
> Reported-by: kbuild test robot <[email protected]>
> Reported-by: Dan Carpenter <[email protected]>

Reviewed-by: Matt Ranostay <[email protected]>

>
> ---
> I've not added a 'Fixes:' line since this is not part of Linus tree yet.
> Tested proximity and ambient light on a vcnl4040 and checked the driver
> suspends/resumes correctly and puts out valid data right after resume.
>
> drivers/iio/light/vcnl4000.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iio/light/vcnl4000.c b/drivers/iio/light/vcnl4000.c
> index 3b71c7d538af..38fcd9a26046 100644
> --- a/drivers/iio/light/vcnl4000.c
> +++ b/drivers/iio/light/vcnl4000.c
> @@ -149,7 +149,7 @@ static int vcnl4200_set_power_state(struct vcnl4000_data *data, bool on)
> if (ret < 0)
> return ret;
>
> - return i2c_smbus_write_word_data(data->client, VCNL4200_PS_CONF1, val);
> + ret = i2c_smbus_write_word_data(data->client, VCNL4200_PS_CONF1, val);
> if (ret < 0)
> return ret;
>
> --
> 2.23.0
>

2020-02-08 14:17:41

by Jonathan Cameron

[permalink] [raw]
Subject: Re: [PATCH] iio: vncl4000: Fix early return in vcnl4200_set_power_state

On Fri, 7 Feb 2020 10:12:09 +0100
Guido Günther <[email protected]> wrote:

> Don't return early unconditionally.
>
> Signed-off-by: Guido Günther <[email protected]>
> Reported-by: kbuild test robot <[email protected]>
> Reported-by: Dan Carpenter <[email protected]>
I've merged this down into the original patch.

Thanks,

Jonathan


>
> ---
> I've not added a 'Fixes:' line since this is not part of Linus tree yet.
> Tested proximity and ambient light on a vcnl4040 and checked the driver
> suspends/resumes correctly and puts out valid data right after resume.
>
> drivers/iio/light/vcnl4000.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iio/light/vcnl4000.c b/drivers/iio/light/vcnl4000.c
> index 3b71c7d538af..38fcd9a26046 100644
> --- a/drivers/iio/light/vcnl4000.c
> +++ b/drivers/iio/light/vcnl4000.c
> @@ -149,7 +149,7 @@ static int vcnl4200_set_power_state(struct vcnl4000_data *data, bool on)
> if (ret < 0)
> return ret;
>
> - return i2c_smbus_write_word_data(data->client, VCNL4200_PS_CONF1, val);
> + ret = i2c_smbus_write_word_data(data->client, VCNL4200_PS_CONF1, val);
> if (ret < 0)
> return ret;
>