* [PATCH][next] iio: invensense: remove redundant initialization of variable period
@ 2024-01-06 15:32 Colin Ian King
2024-01-07 16:07 ` Jonathan Cameron
0 siblings, 1 reply; 4+ messages in thread
From: Colin Ian King @ 2024-01-06 15:32 UTC (permalink / raw)
To: Jonathan Cameron, Lars-Peter Clausen, Jean-Baptiste Maneyrol,
Andy Shevchenko, linux-iio
Cc: kernel-janitors, linux-kernel
The variable period is being initialized with a value that is never
read, it is being re-assigned a new value later on before it is read.
The initialization is redundant and can be removed.
Cleans up clang scan build warning:
Value stored to 'period' during its initialization is never
read [deadcode.DeadStores]
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
drivers/iio/common/inv_sensors/inv_sensors_timestamp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/common/inv_sensors/inv_sensors_timestamp.c b/drivers/iio/common/inv_sensors/inv_sensors_timestamp.c
index 03823ee57f59..3b0f9598a7c7 100644
--- a/drivers/iio/common/inv_sensors/inv_sensors_timestamp.c
+++ b/drivers/iio/common/inv_sensors/inv_sensors_timestamp.c
@@ -126,7 +126,7 @@ void inv_sensors_timestamp_interrupt(struct inv_sensors_timestamp *ts,
struct inv_sensors_timestamp_interval *it;
int64_t delta, interval;
const uint32_t fifo_mult = fifo_period / ts->chip.clock_period;
- uint32_t period = ts->period;
+ uint32_t period;
bool valid = false;
if (fifo_nb == 0)
--
2.39.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH][next] iio: invensense: remove redundant initialization of variable period
2024-01-06 15:32 [PATCH][next] iio: invensense: remove redundant initialization of variable period Colin Ian King
@ 2024-01-07 16:07 ` Jonathan Cameron
2024-01-07 20:18 ` Jean-Baptiste Maneyrol
0 siblings, 1 reply; 4+ messages in thread
From: Jonathan Cameron @ 2024-01-07 16:07 UTC (permalink / raw)
To: Colin Ian King
Cc: Lars-Peter Clausen, Jean-Baptiste Maneyrol, Andy Shevchenko,
linux-iio, kernel-janitors, linux-kernel
On Sat, 6 Jan 2024 15:32:02 +0000
Colin Ian King <colin.i.king@gmail.com> wrote:
> The variable period is being initialized with a value that is never
> read, it is being re-assigned a new value later on before it is read.
> The initialization is redundant and can be removed.
>
> Cleans up clang scan build warning:
> Value stored to 'period' during its initialization is never
> read [deadcode.DeadStores]
>
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Hi Colin,
I definitely want input from someone who can test this.
There is direct use of ts->period as well as the local
variable that is indeed overwritten as you've noted.
Feels like naming needs some work and perhaps reduce the scope of
the period local variable so it's obvious it was only intended
for more local use than it currently looks like.
Thanks,
Jonathan
> ---
> drivers/iio/common/inv_sensors/inv_sensors_timestamp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iio/common/inv_sensors/inv_sensors_timestamp.c b/drivers/iio/common/inv_sensors/inv_sensors_timestamp.c
> index 03823ee57f59..3b0f9598a7c7 100644
> --- a/drivers/iio/common/inv_sensors/inv_sensors_timestamp.c
> +++ b/drivers/iio/common/inv_sensors/inv_sensors_timestamp.c
> @@ -126,7 +126,7 @@ void inv_sensors_timestamp_interrupt(struct inv_sensors_timestamp *ts,
> struct inv_sensors_timestamp_interval *it;
> int64_t delta, interval;
> const uint32_t fifo_mult = fifo_period / ts->chip.clock_period;
> - uint32_t period = ts->period;
> + uint32_t period;
> bool valid = false;
>
> if (fifo_nb == 0)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH][next] iio: invensense: remove redundant initialization of variable period
2024-01-07 16:07 ` Jonathan Cameron
@ 2024-01-07 20:18 ` Jean-Baptiste Maneyrol
2024-01-13 15:11 ` Jonathan Cameron
0 siblings, 1 reply; 4+ messages in thread
From: Jean-Baptiste Maneyrol @ 2024-01-07 20:18 UTC (permalink / raw)
To: Jonathan Cameron, Colin Ian King
Cc: Lars-Peter Clausen, Andy Shevchenko, linux-iio@vger.kernel.org,
kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Hello Colin & Jonathan,
this is OK for me, thanks for the patch.
The initialization is certainly coming from first development and is not needed.
Acked-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Thanks,
JB
From: Jonathan Cameron <jic23@kernel.org>
Sent: Sunday, January 7, 2024 17:07
To: Colin Ian King <colin.i.king@gmail.com>
Cc: Lars-Peter Clausen <lars@metafoo.de>; Jean-Baptiste Maneyrol <Jean-Baptiste.Maneyrol@tdk.com>; Andy Shevchenko <andy.shevchenko@gmail.com>; linux-iio@vger.kernel.org <linux-iio@vger.kernel.org>; kernel-janitors@vger.kernel.org <kernel-janitors@vger.kernel.org>; linux-kernel@vger.kernel.org <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH][next] iio: invensense: remove redundant initialization of variable period
On Sat, 6 Jan 2024 15: 32: 02 +0000 Colin Ian King <colin. i. king@ gmail. com> wrote: > The variable period is being initialized with a value that is never > read, it is being re-assigned a new value later on before it is read. >
ZjQcmQRYFpfptBannerStart
This Message Is From an External Sender
This message came from outside your organization.
ZjQcmQRYFpfptBannerEnd
On Sat, 6 Jan 2024 15:32:02 +0000
Colin Ian King <colin.i.king@gmail.com> wrote:
> The variable period is being initialized with a value that is never
> read, it is being re-assigned a new value later on before it is read.
> The initialization is redundant and can be removed.
>
> Cleans up clang scan build warning:
> Value stored to 'period' during its initialization is never
> read [deadcode.DeadStores]
>
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Hi Colin,
I definitely want input from someone who can test this.
There is direct use of ts->period as well as the local
variable that is indeed overwritten as you've noted.
Feels like naming needs some work and perhaps reduce the scope of
the period local variable so it's obvious it was only intended
for more local use than it currently looks like.
Thanks,
Jonathan
> ---
> drivers/iio/common/inv_sensors/inv_sensors_timestamp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iio/common/inv_sensors/inv_sensors_timestamp.c b/drivers/iio/common/inv_sensors/inv_sensors_timestamp.c
> index 03823ee57f59..3b0f9598a7c7 100644
> --- a/drivers/iio/common/inv_sensors/inv_sensors_timestamp.c
> +++ b/drivers/iio/common/inv_sensors/inv_sensors_timestamp.c
> @@ -126,7 +126,7 @@ void inv_sensors_timestamp_interrupt(struct inv_sensors_timestamp *ts,
> struct inv_sensors_timestamp_interval *it;
> int64_t delta, interval;
> const uint32_t fifo_mult = fifo_period / ts->chip.clock_period;
> - uint32_t period = ts->period;
> + uint32_t period;
> bool valid = false;
>
> if (fifo_nb == 0)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH][next] iio: invensense: remove redundant initialization of variable period
2024-01-07 20:18 ` Jean-Baptiste Maneyrol
@ 2024-01-13 15:11 ` Jonathan Cameron
0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Cameron @ 2024-01-13 15:11 UTC (permalink / raw)
To: Jean-Baptiste Maneyrol
Cc: Colin Ian King, Lars-Peter Clausen, Andy Shevchenko,
linux-iio@vger.kernel.org, kernel-janitors@vger.kernel.org,
linux-kernel@vger.kernel.org
On Sun, 7 Jan 2024 20:18:03 +0000
Jean-Baptiste Maneyrol <Jean-Baptiste.Maneyrol@tdk.com> wrote:
> Hello Colin & Jonathan,
>
> this is OK for me, thanks for the patch.
> The initialization is certainly coming from first development and is not needed.
>
> Acked-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Applied to the togreg branch of iio.git and pushed out as testing.
I'll be rebasing that tree on rc1 once available.
Thanks,
Jonathan
>
> Thanks,
> JB
>
> From: Jonathan Cameron <jic23@kernel.org>
> Sent: Sunday, January 7, 2024 17:07
> To: Colin Ian King <colin.i.king@gmail.com>
> Cc: Lars-Peter Clausen <lars@metafoo.de>; Jean-Baptiste Maneyrol <Jean-Baptiste.Maneyrol@tdk.com>; Andy Shevchenko <andy.shevchenko@gmail.com>; linux-iio@vger.kernel.org <linux-iio@vger.kernel.org>; kernel-janitors@vger.kernel.org <kernel-janitors@vger.kernel.org>; linux-kernel@vger.kernel.org <linux-kernel@vger.kernel.org>
> Subject: Re: [PATCH][next] iio: invensense: remove redundant initialization of variable period
>
> On Sat, 6 Jan 2024 15: 32: 02 +0000 Colin Ian King <colin. i. king@ gmail. com> wrote: > The variable period is being initialized with a value that is never > read, it is being re-assigned a new value later on before it is read. >
> ZjQcmQRYFpfptBannerStart
> This Message Is From an External Sender
> This message came from outside your organization.
>
> ZjQcmQRYFpfptBannerEnd
> On Sat, 6 Jan 2024 15:32:02 +0000
> Colin Ian King <colin.i.king@gmail.com> wrote:
>
> > The variable period is being initialized with a value that is never
> > read, it is being re-assigned a new value later on before it is read.
> > The initialization is redundant and can be removed.
> >
> > Cleans up clang scan build warning:
> > Value stored to 'period' during its initialization is never
> > read [deadcode.DeadStores]
> >
> > Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
> Hi Colin,
>
> I definitely want input from someone who can test this.
> There is direct use of ts->period as well as the local
> variable that is indeed overwritten as you've noted.
> Feels like naming needs some work and perhaps reduce the scope of
> the period local variable so it's obvious it was only intended
> for more local use than it currently looks like.
>
> Thanks,
>
> Jonathan
>
> > ---
> > drivers/iio/common/inv_sensors/inv_sensors_timestamp.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/iio/common/inv_sensors/inv_sensors_timestamp.c b/drivers/iio/common/inv_sensors/inv_sensors_timestamp.c
> > index 03823ee57f59..3b0f9598a7c7 100644
> > --- a/drivers/iio/common/inv_sensors/inv_sensors_timestamp.c
> > +++ b/drivers/iio/common/inv_sensors/inv_sensors_timestamp.c
> > @@ -126,7 +126,7 @@ void inv_sensors_timestamp_interrupt(struct inv_sensors_timestamp *ts,
> > struct inv_sensors_timestamp_interval *it;
> > int64_t delta, interval;
> > const uint32_t fifo_mult = fifo_period / ts->chip.clock_period;
> > - uint32_t period = ts->period;
> > + uint32_t period;
> > bool valid = false;
> >
> > if (fifo_nb == 0)
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-01-13 15:11 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-06 15:32 [PATCH][next] iio: invensense: remove redundant initialization of variable period Colin Ian King
2024-01-07 16:07 ` Jonathan Cameron
2024-01-07 20:18 ` Jean-Baptiste Maneyrol
2024-01-13 15:11 ` Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox