All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iio: stmpe-adc: avoid harmless clang warning
@ 2019-03-22 14:08 ` Arnd Bergmann
  0 siblings, 0 replies; 6+ messages in thread
From: Arnd Bergmann @ 2019-03-22 14:08 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: clang-built-linux, Nick Desaulniers, Nathan Chancellor,
	Arnd Bergmann, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Max Krummenacher, Lee Jones,
	Stefan Agner, linux-iio, linux-stm32, linux-arm-kernel,
	linux-kernel

Clang points out a control flow bug, which happens to be harmless:

drivers/iio/adc/stmpe-adc.c:204:13: error: variable 'data' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]

The warning is sensible here, so let's just avoid the case by
adding appropriate error handling.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/iio/adc/stmpe-adc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/iio/adc/stmpe-adc.c b/drivers/iio/adc/stmpe-adc.c
index 37f4b74a5d32..ed3817c5c896 100644
--- a/drivers/iio/adc/stmpe-adc.c
+++ b/drivers/iio/adc/stmpe-adc.c
@@ -205,6 +205,8 @@ static irqreturn_t stmpe_adc_isr(int irq, void *dev_id)
 		/* Read value */
 		stmpe_block_read(info->stmpe, STMPE_REG_TEMP_DATA, 2,
 				(u8 *) &data);
+	} else {
+		return IRQ_NONE;
 	}
 
 	info->value = (u32) be16_to_cpu(data);
-- 
2.20.0


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

* [PATCH] iio: stmpe-adc: avoid harmless clang warning
@ 2019-03-22 14:08 ` Arnd Bergmann
  0 siblings, 0 replies; 6+ messages in thread
From: Arnd Bergmann @ 2019-03-22 14:08 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Lars-Peter Clausen, Max Krummenacher, Arnd Bergmann, linux-iio,
	Nick Desaulniers, linux-kernel, Stefan Agner, clang-built-linux,
	Peter Meerwald-Stadler, Hartmut Knaack, Nathan Chancellor,
	Lee Jones, linux-stm32, linux-arm-kernel

Clang points out a control flow bug, which happens to be harmless:

drivers/iio/adc/stmpe-adc.c:204:13: error: variable 'data' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]

The warning is sensible here, so let's just avoid the case by
adding appropriate error handling.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/iio/adc/stmpe-adc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/iio/adc/stmpe-adc.c b/drivers/iio/adc/stmpe-adc.c
index 37f4b74a5d32..ed3817c5c896 100644
--- a/drivers/iio/adc/stmpe-adc.c
+++ b/drivers/iio/adc/stmpe-adc.c
@@ -205,6 +205,8 @@ static irqreturn_t stmpe_adc_isr(int irq, void *dev_id)
 		/* Read value */
 		stmpe_block_read(info->stmpe, STMPE_REG_TEMP_DATA, 2,
 				(u8 *) &data);
+	} else {
+		return IRQ_NONE;
 	}
 
 	info->value = (u32) be16_to_cpu(data);
-- 
2.20.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] iio: stmpe-adc: avoid harmless clang warning
  2019-03-22 14:08 ` Arnd Bergmann
@ 2019-03-22 14:58   ` Nathan Chancellor
  -1 siblings, 0 replies; 6+ messages in thread
From: Nathan Chancellor @ 2019-03-22 14:58 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Jonathan Cameron, clang-built-linux, Nick Desaulniers,
	Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler,
	Max Krummenacher, Lee Jones, Stefan Agner, linux-iio,
	linux-stm32, linux-arm-kernel, linux-kernel

On Fri, Mar 22, 2019 at 03:08:39PM +0100, Arnd Bergmann wrote:
> Clang points out a control flow bug, which happens to be harmless:
> 
> drivers/iio/adc/stmpe-adc.c:204:13: error: variable 'data' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
> 
> The warning is sensible here, so let's just avoid the case by
> adding appropriate error handling.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/iio/adc/stmpe-adc.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/iio/adc/stmpe-adc.c b/drivers/iio/adc/stmpe-adc.c
> index 37f4b74a5d32..ed3817c5c896 100644
> --- a/drivers/iio/adc/stmpe-adc.c
> +++ b/drivers/iio/adc/stmpe-adc.c
> @@ -205,6 +205,8 @@ static irqreturn_t stmpe_adc_isr(int irq, void *dev_id)
>  		/* Read value */
>  		stmpe_block_read(info->stmpe, STMPE_REG_TEMP_DATA, 2,
>  				(u8 *) &data);
> +	} else {
> +		return IRQ_NONE;
>  	}
>  
>  	info->value = (u32) be16_to_cpu(data);
> -- 
> 2.20.0
> 

I sent a similar patch, which is sitting in Jonathan's testing branch:

https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git/commit/?id=e15146e4d4349b3f309f5591ea8de8d24071265f

Nathan

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

* Re: [PATCH] iio: stmpe-adc: avoid harmless clang warning
@ 2019-03-22 14:58   ` Nathan Chancellor
  0 siblings, 0 replies; 6+ messages in thread
From: Nathan Chancellor @ 2019-03-22 14:58 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Lars-Peter Clausen, Max Krummenacher, linux-iio,
	Nick Desaulniers, linux-kernel, Stefan Agner, clang-built-linux,
	linux-arm-kernel, Peter Meerwald-Stadler, Hartmut Knaack,
	Lee Jones, linux-stm32, Jonathan Cameron

On Fri, Mar 22, 2019 at 03:08:39PM +0100, Arnd Bergmann wrote:
> Clang points out a control flow bug, which happens to be harmless:
> 
> drivers/iio/adc/stmpe-adc.c:204:13: error: variable 'data' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
> 
> The warning is sensible here, so let's just avoid the case by
> adding appropriate error handling.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/iio/adc/stmpe-adc.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/iio/adc/stmpe-adc.c b/drivers/iio/adc/stmpe-adc.c
> index 37f4b74a5d32..ed3817c5c896 100644
> --- a/drivers/iio/adc/stmpe-adc.c
> +++ b/drivers/iio/adc/stmpe-adc.c
> @@ -205,6 +205,8 @@ static irqreturn_t stmpe_adc_isr(int irq, void *dev_id)
>  		/* Read value */
>  		stmpe_block_read(info->stmpe, STMPE_REG_TEMP_DATA, 2,
>  				(u8 *) &data);
> +	} else {
> +		return IRQ_NONE;
>  	}
>  
>  	info->value = (u32) be16_to_cpu(data);
> -- 
> 2.20.0
> 

I sent a similar patch, which is sitting in Jonathan's testing branch:

https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git/commit/?id=e15146e4d4349b3f309f5591ea8de8d24071265f

Nathan

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] iio: stmpe-adc: avoid harmless clang warning
  2019-03-22 14:58   ` Nathan Chancellor
@ 2019-03-22 15:09     ` Arnd Bergmann
  -1 siblings, 0 replies; 6+ messages in thread
From: Arnd Bergmann @ 2019-03-22 15:09 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Jonathan Cameron, clang-built-linux, Nick Desaulniers,
	Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler,
	Max Krummenacher, Lee Jones, Stefan Agner, linux-iio,
	linux-stm32, Linux ARM, Linux Kernel Mailing List

On Fri, Mar 22, 2019 at 3:58 PM Nathan Chancellor
<natechancellor@gmail.com> wrote:
>
> On Fri, Mar 22, 2019 at 03:08:39PM +0100, Arnd Bergmann wrote:
> > Clang points out a control flow bug, which happens to be harmless:
> >
> > drivers/iio/adc/stmpe-adc.c:204:13: error: variable 'data' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
> >
> > The warning is sensible here, so let's just avoid the case by
> > adding appropriate error handling.
> >
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> > ---
> >  drivers/iio/adc/stmpe-adc.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/iio/adc/stmpe-adc.c b/drivers/iio/adc/stmpe-adc.c
> > index 37f4b74a5d32..ed3817c5c896 100644
> > --- a/drivers/iio/adc/stmpe-adc.c
> > +++ b/drivers/iio/adc/stmpe-adc.c
> > @@ -205,6 +205,8 @@ static irqreturn_t stmpe_adc_isr(int irq, void *dev_id)
> >               /* Read value */
> >               stmpe_block_read(info->stmpe, STMPE_REG_TEMP_DATA, 2,
> >                               (u8 *) &data);
> > +     } else {
> > +             return IRQ_NONE;
> >       }
> >
> >       info->value = (u32) be16_to_cpu(data);
> > --
> > 2.20.0
> >
>
> I sent a similar patch, which is sitting in Jonathan's testing branch:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git/commit/?id=e15146e4d4349b3f309f5591ea8de8d24071265f

Ok, sorry for the dup. Your seems to be better than mine, too.

      Arnd

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

* Re: [PATCH] iio: stmpe-adc: avoid harmless clang warning
@ 2019-03-22 15:09     ` Arnd Bergmann
  0 siblings, 0 replies; 6+ messages in thread
From: Arnd Bergmann @ 2019-03-22 15:09 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Lars-Peter Clausen, Max Krummenacher, linux-iio,
	Nick Desaulniers, Linux Kernel Mailing List, Stefan Agner,
	clang-built-linux, Linux ARM, Peter Meerwald-Stadler,
	Hartmut Knaack, Lee Jones, linux-stm32, Jonathan Cameron

On Fri, Mar 22, 2019 at 3:58 PM Nathan Chancellor
<natechancellor@gmail.com> wrote:
>
> On Fri, Mar 22, 2019 at 03:08:39PM +0100, Arnd Bergmann wrote:
> > Clang points out a control flow bug, which happens to be harmless:
> >
> > drivers/iio/adc/stmpe-adc.c:204:13: error: variable 'data' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
> >
> > The warning is sensible here, so let's just avoid the case by
> > adding appropriate error handling.
> >
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> > ---
> >  drivers/iio/adc/stmpe-adc.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/iio/adc/stmpe-adc.c b/drivers/iio/adc/stmpe-adc.c
> > index 37f4b74a5d32..ed3817c5c896 100644
> > --- a/drivers/iio/adc/stmpe-adc.c
> > +++ b/drivers/iio/adc/stmpe-adc.c
> > @@ -205,6 +205,8 @@ static irqreturn_t stmpe_adc_isr(int irq, void *dev_id)
> >               /* Read value */
> >               stmpe_block_read(info->stmpe, STMPE_REG_TEMP_DATA, 2,
> >                               (u8 *) &data);
> > +     } else {
> > +             return IRQ_NONE;
> >       }
> >
> >       info->value = (u32) be16_to_cpu(data);
> > --
> > 2.20.0
> >
>
> I sent a similar patch, which is sitting in Jonathan's testing branch:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git/commit/?id=e15146e4d4349b3f309f5591ea8de8d24071265f

Ok, sorry for the dup. Your seems to be better than mine, too.

      Arnd

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2019-03-22 15:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-22 14:08 [PATCH] iio: stmpe-adc: avoid harmless clang warning Arnd Bergmann
2019-03-22 14:08 ` Arnd Bergmann
2019-03-22 14:58 ` Nathan Chancellor
2019-03-22 14:58   ` Nathan Chancellor
2019-03-22 15:09   ` Arnd Bergmann
2019-03-22 15:09     ` Arnd Bergmann

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.