All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iio: dac: ad5592r: Fix the missing return value.
@ 2022-03-10 12:54 Zizhuang Deng
  2022-03-20 15:20 ` Jonathan Cameron
  0 siblings, 1 reply; 5+ messages in thread
From: Zizhuang Deng @ 2022-03-10 12:54 UTC (permalink / raw)
  To: Jonathan.Cameron; +Cc: linux-kernel, linux-iio, Zizhuang Deng

The third call to `fwnode_property_read_u32` did not record
the return value, resulting in `channel_offstate` possibly
being assigned the wrong value.

Signed-off-by: Zizhuang Deng <sunsetdzz@gmail.com>
---
 drivers/iio/dac/ad5592r-base.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/dac/ad5592r-base.c b/drivers/iio/dac/ad5592r-base.c
index a424b7220b61..4434c1b2a322 100644
--- a/drivers/iio/dac/ad5592r-base.c
+++ b/drivers/iio/dac/ad5592r-base.c
@@ -522,7 +522,7 @@ static int ad5592r_alloc_channels(struct iio_dev *iio_dev)
 		if (!ret)
 			st->channel_modes[reg] = tmp;
 
-		fwnode_property_read_u32(child, "adi,off-state", &tmp);
+		ret = fwnode_property_read_u32(child, "adi,off-state", &tmp);
 		if (!ret)
 			st->channel_offstate[reg] = tmp;
 	}
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] iio: dac: ad5592r: Fix the missing return value.
  2022-03-10 12:54 [PATCH] iio: dac: ad5592r: Fix the missing return value Zizhuang Deng
@ 2022-03-20 15:20 ` Jonathan Cameron
  2022-03-21  9:28   ` Paul Cercueil
  0 siblings, 1 reply; 5+ messages in thread
From: Jonathan Cameron @ 2022-03-20 15:20 UTC (permalink / raw)
  To: Zizhuang Deng
  Cc: Jonathan.Cameron, linux-kernel, linux-iio, Paul Cercueil, Paul Cercueil

On Thu, 10 Mar 2022 20:54:50 +0800
Zizhuang Deng <sunsetdzz@gmail.com> wrote:

> The third call to `fwnode_property_read_u32` did not record
> the return value, resulting in `channel_offstate` possibly
> being assigned the wrong value.
> 
> Signed-off-by: Zizhuang Deng <sunsetdzz@gmail.com>
Hi,

Definitely rather odd looking and I think your conclusion is correct.
+CC Paul for confirmation that this isn't doing something clever..

> ---
>  drivers/iio/dac/ad5592r-base.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/dac/ad5592r-base.c b/drivers/iio/dac/ad5592r-base.c
> index a424b7220b61..4434c1b2a322 100644
> --- a/drivers/iio/dac/ad5592r-base.c
> +++ b/drivers/iio/dac/ad5592r-base.c
> @@ -522,7 +522,7 @@ static int ad5592r_alloc_channels(struct iio_dev *iio_dev)
>  		if (!ret)
>  			st->channel_modes[reg] = tmp;
>  
> -		fwnode_property_read_u32(child, "adi,off-state", &tmp);
> +		ret = fwnode_property_read_u32(child, "adi,off-state", &tmp);
>  		if (!ret)
>  			st->channel_offstate[reg] = tmp;
>  	}


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] iio: dac: ad5592r: Fix the missing return value.
  2022-03-20 15:20 ` Jonathan Cameron
@ 2022-03-21  9:28   ` Paul Cercueil
  2022-03-27 16:19     ` Jonathan Cameron
  2022-03-27 19:52     ` Andy Shevchenko
  0 siblings, 2 replies; 5+ messages in thread
From: Paul Cercueil @ 2022-03-21  9:28 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Zizhuang Deng, Jonathan.Cameron, linux-kernel, linux-iio, Paul Cercueil

Hi,

Le dim., mars 20 2022 at 15:20:47 +0000, Jonathan Cameron 
<jic23@kernel.org> a écrit :
> On Thu, 10 Mar 2022 20:54:50 +0800
> Zizhuang Deng <sunsetdzz@gmail.com> wrote:
> 
>>  The third call to `fwnode_property_read_u32` did not record
>>  the return value, resulting in `channel_offstate` possibly
>>  being assigned the wrong value.
>> 
>>  Signed-off-by: Zizhuang Deng <sunsetdzz@gmail.com>
> Hi,
> 
> Definitely rather odd looking and I think your conclusion is correct.
> +CC Paul for confirmation that this isn't doing something clever..

It's been a while, but I don't think there was anything clever going on 
here - so the patch is fine.

Cheers,
-Paul

> 
>>  ---
>>   drivers/iio/dac/ad5592r-base.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>>  diff --git a/drivers/iio/dac/ad5592r-base.c 
>> b/drivers/iio/dac/ad5592r-base.c
>>  index a424b7220b61..4434c1b2a322 100644
>>  --- a/drivers/iio/dac/ad5592r-base.c
>>  +++ b/drivers/iio/dac/ad5592r-base.c
>>  @@ -522,7 +522,7 @@ static int ad5592r_alloc_channels(struct 
>> iio_dev *iio_dev)
>>   		if (!ret)
>>   			st->channel_modes[reg] = tmp;
>> 
>>  -		fwnode_property_read_u32(child, "adi,off-state", &tmp);
>>  +		ret = fwnode_property_read_u32(child, "adi,off-state", &tmp);
>>   		if (!ret)
>>   			st->channel_offstate[reg] = tmp;
>>   	}
> 



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] iio: dac: ad5592r: Fix the missing return value.
  2022-03-21  9:28   ` Paul Cercueil
@ 2022-03-27 16:19     ` Jonathan Cameron
  2022-03-27 19:52     ` Andy Shevchenko
  1 sibling, 0 replies; 5+ messages in thread
From: Jonathan Cameron @ 2022-03-27 16:19 UTC (permalink / raw)
  To: Paul Cercueil
  Cc: Zizhuang Deng, Jonathan.Cameron, linux-kernel, linux-iio, Paul Cercueil

On Mon, 21 Mar 2022 09:28:36 +0000
Paul Cercueil <paul@crapouillou.net> wrote:

> Hi,
> 
> Le dim., mars 20 2022 at 15:20:47 +0000, Jonathan Cameron 
> <jic23@kernel.org> a écrit :
> > On Thu, 10 Mar 2022 20:54:50 +0800
> > Zizhuang Deng <sunsetdzz@gmail.com> wrote:
> >   
> >>  The third call to `fwnode_property_read_u32` did not record
> >>  the return value, resulting in `channel_offstate` possibly
> >>  being assigned the wrong value.
> >> 
> >>  Signed-off-by: Zizhuang Deng <sunsetdzz@gmail.com>  
> > Hi,
> > 
> > Definitely rather odd looking and I think your conclusion is correct.
> > +CC Paul for confirmation that this isn't doing something clever..  
> 
> It's been a while, but I don't think there was anything clever going on 
> here - so the patch is fine.

Added a fixes tag (it was driver introduction) and marked for stable
given this could have some weird side effects if anyone actually
had a dt that hit this path.  Applied to the fixes-togreg branch of iio.git
but not pushed out yet as I'll be rebasing that branch on rc1 next week.

Thanks,

Jonathan

> 
> Cheers,
> -Paul
> 
> >   
> >>  ---
> >>   drivers/iio/dac/ad5592r-base.c | 2 +-
> >>   1 file changed, 1 insertion(+), 1 deletion(-)
> >> 
> >>  diff --git a/drivers/iio/dac/ad5592r-base.c 
> >> b/drivers/iio/dac/ad5592r-base.c
> >>  index a424b7220b61..4434c1b2a322 100644
> >>  --- a/drivers/iio/dac/ad5592r-base.c
> >>  +++ b/drivers/iio/dac/ad5592r-base.c
> >>  @@ -522,7 +522,7 @@ static int ad5592r_alloc_channels(struct 
> >> iio_dev *iio_dev)
> >>   		if (!ret)
> >>   			st->channel_modes[reg] = tmp;
> >> 
> >>  -		fwnode_property_read_u32(child, "adi,off-state", &tmp);
> >>  +		ret = fwnode_property_read_u32(child, "adi,off-state", &tmp);
> >>   		if (!ret)
> >>   			st->channel_offstate[reg] = tmp;
> >>   	}  
> >   
> 
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] iio: dac: ad5592r: Fix the missing return value.
  2022-03-21  9:28   ` Paul Cercueil
  2022-03-27 16:19     ` Jonathan Cameron
@ 2022-03-27 19:52     ` Andy Shevchenko
  1 sibling, 0 replies; 5+ messages in thread
From: Andy Shevchenko @ 2022-03-27 19:52 UTC (permalink / raw)
  To: Paul Cercueil
  Cc: Jonathan Cameron, Zizhuang Deng, Jonathan Cameron,
	Linux Kernel Mailing List, linux-iio, Paul Cercueil

On Mon, Mar 21, 2022 at 11:34 AM Paul Cercueil <paul@crapouillou.net> wrote:
> Le dim., mars 20 2022 at 15:20:47 +0000, Jonathan Cameron
> <jic23@kernel.org> a écrit :
> > On Thu, 10 Mar 2022 20:54:50 +0800
> > Zizhuang Deng <sunsetdzz@gmail.com> wrote:
> >
> >>  The third call to `fwnode_property_read_u32` did not record
> >>  the return value, resulting in `channel_offstate` possibly
> >>  being assigned the wrong value.

> > Definitely rather odd looking and I think your conclusion is correct.
> > +CC Paul for confirmation that this isn't doing something clever..
>
> It's been a while, but I don't think there was anything clever going on
> here - so the patch is fine.

Basically the question here is what value should offstate have when
there is no such property. Currently it's the same value as modes (no
seeing context other than in the patch).

> >>              if (!ret)
> >>                      st->channel_modes[reg] = tmp;
> >>
> >>  -           fwnode_property_read_u32(child, "adi,off-state", &tmp);
> >>  +           ret = fwnode_property_read_u32(child, "adi,off-state", &tmp);
> >>              if (!ret)
> >>                      st->channel_offstate[reg] = tmp;


-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-03-27 19:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-10 12:54 [PATCH] iio: dac: ad5592r: Fix the missing return value Zizhuang Deng
2022-03-20 15:20 ` Jonathan Cameron
2022-03-21  9:28   ` Paul Cercueil
2022-03-27 16:19     ` Jonathan Cameron
2022-03-27 19:52     ` Andy Shevchenko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.