patches.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH] iio:proximity:sx9324: Check ret value of device_property_read_u32_array()
@ 2022-06-13 23:22 Stephen Boyd
  2022-06-13 23:25 ` Gwendal Grignou
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Boyd @ 2022-06-13 23:22 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Aashish Sharma, linux-kernel, patches, linux-iio, Gwendal Grignou,
	kernel test robot

From: Aashish Sharma <shraash@google.com>

0-day reports:

drivers/iio/proximity/sx9324.c:868:3: warning: Value stored
to 'ret' is never read [clang-analyzer-deadcode.DeadStores]

Put an if condition to break out of switch if ret is non-zero.

Signed-off-by: Aashish Sharma <shraash@google.com>
Fixes: a8ee3b32f5da ("iio:proximity:sx9324: Add dt_binding support")
Reported-by: kernel test robot <lkp@intel.com>
[swboyd@chromium.org: Reword commit subject, add fixes tag]
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
---
 drivers/iio/proximity/sx9324.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/iio/proximity/sx9324.c b/drivers/iio/proximity/sx9324.c
index 70c37f664f6d..63fbcaa4cac8 100644
--- a/drivers/iio/proximity/sx9324.c
+++ b/drivers/iio/proximity/sx9324.c
@@ -885,6 +885,9 @@ sx9324_get_default_reg(struct device *dev, int idx,
 			break;
 		ret = device_property_read_u32_array(dev, prop, pin_defs,
 						     ARRAY_SIZE(pin_defs));
+		if (ret)
+			break;
+
 		for (pin = 0; pin < SX9324_NUM_PINS; pin++)
 			raw |= (pin_defs[pin] << (2 * pin)) &
 			       SX9324_REG_AFE_PH0_PIN_MASK(pin);

base-commit: f2906aa863381afb0015a9eb7fefad885d4e5a56
-- 
https://chromeos.dev


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

* Re: [PATCH] iio:proximity:sx9324: Check ret value of device_property_read_u32_array()
  2022-06-13 23:22 [PATCH] iio:proximity:sx9324: Check ret value of device_property_read_u32_array() Stephen Boyd
@ 2022-06-13 23:25 ` Gwendal Grignou
  2022-06-18 16:52   ` Jonathan Cameron
  0 siblings, 1 reply; 3+ messages in thread
From: Gwendal Grignou @ 2022-06-13 23:25 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Jonathan Cameron, Aashish Sharma, linux-kernel, patches,
	linux-iio, kernel test robot

On Mon, Jun 13, 2022 at 4:22 PM Stephen Boyd <swboyd@chromium.org> wrote:
>
> From: Aashish Sharma <shraash@google.com>
>
> 0-day reports:
>
> drivers/iio/proximity/sx9324.c:868:3: warning: Value stored
> to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
>
> Put an if condition to break out of switch if ret is non-zero.
>
> Signed-off-by: Aashish Sharma <shraash@google.com>
> Fixes: a8ee3b32f5da ("iio:proximity:sx9324: Add dt_binding support")
> Reported-by: kernel test robot <lkp@intel.com>
> [swboyd@chromium.org: Reword commit subject, add fixes tag]
> Signed-off-by: Stephen Boyd <swboyd@chromium.org>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
> ---
>  drivers/iio/proximity/sx9324.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/iio/proximity/sx9324.c b/drivers/iio/proximity/sx9324.c
> index 70c37f664f6d..63fbcaa4cac8 100644
> --- a/drivers/iio/proximity/sx9324.c
> +++ b/drivers/iio/proximity/sx9324.c
> @@ -885,6 +885,9 @@ sx9324_get_default_reg(struct device *dev, int idx,
>                         break;
>                 ret = device_property_read_u32_array(dev, prop, pin_defs,
>                                                      ARRAY_SIZE(pin_defs));
> +               if (ret)
> +                       break;
> +
>                 for (pin = 0; pin < SX9324_NUM_PINS; pin++)
>                         raw |= (pin_defs[pin] << (2 * pin)) &
>                                SX9324_REG_AFE_PH0_PIN_MASK(pin);
>
> base-commit: f2906aa863381afb0015a9eb7fefad885d4e5a56
> --
> https://chromeos.dev
>

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

* Re: [PATCH] iio:proximity:sx9324: Check ret value of device_property_read_u32_array()
  2022-06-13 23:25 ` Gwendal Grignou
@ 2022-06-18 16:52   ` Jonathan Cameron
  0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Cameron @ 2022-06-18 16:52 UTC (permalink / raw)
  To: Gwendal Grignou
  Cc: Stephen Boyd, Aashish Sharma, linux-kernel, patches, linux-iio,
	kernel test robot

On Mon, 13 Jun 2022 16:25:55 -0700
Gwendal Grignou <gwendal@chromium.org> wrote:

> On Mon, Jun 13, 2022 at 4:22 PM Stephen Boyd <swboyd@chromium.org> wrote:
> >
> > From: Aashish Sharma <shraash@google.com>
> >
> > 0-day reports:
> >
> > drivers/iio/proximity/sx9324.c:868:3: warning: Value stored
> > to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
> >
> > Put an if condition to break out of switch if ret is non-zero.
> >
> > Signed-off-by: Aashish Sharma <shraash@google.com>
> > Fixes: a8ee3b32f5da ("iio:proximity:sx9324: Add dt_binding support")
> > Reported-by: kernel test robot <lkp@intel.com>
> > [swboyd@chromium.org: Reword commit subject, add fixes tag]
> > Signed-off-by: Stephen Boyd <swboyd@chromium.org>  
> Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Applied to the fixes-togreg branch of iio.git and marked for stable.

Thanks,

Jonathan

> > ---
> >  drivers/iio/proximity/sx9324.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/drivers/iio/proximity/sx9324.c b/drivers/iio/proximity/sx9324.c
> > index 70c37f664f6d..63fbcaa4cac8 100644
> > --- a/drivers/iio/proximity/sx9324.c
> > +++ b/drivers/iio/proximity/sx9324.c
> > @@ -885,6 +885,9 @@ sx9324_get_default_reg(struct device *dev, int idx,
> >                         break;
> >                 ret = device_property_read_u32_array(dev, prop, pin_defs,
> >                                                      ARRAY_SIZE(pin_defs));
> > +               if (ret)
> > +                       break;
> > +
> >                 for (pin = 0; pin < SX9324_NUM_PINS; pin++)
> >                         raw |= (pin_defs[pin] << (2 * pin)) &
> >                                SX9324_REG_AFE_PH0_PIN_MASK(pin);
> >
> > base-commit: f2906aa863381afb0015a9eb7fefad885d4e5a56
> > --
> > https://chromeos.dev
> >  


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

end of thread, other threads:[~2022-06-18 16:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-13 23:22 [PATCH] iio:proximity:sx9324: Check ret value of device_property_read_u32_array() Stephen Boyd
2022-06-13 23:25 ` Gwendal Grignou
2022-06-18 16:52   ` 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).