Linux IIO development
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
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, kernel-janitors@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH][next] iio: invensense: remove redundant initialization of variable period
Date: Sun, 7 Jan 2024 16:07:36 +0000	[thread overview]
Message-ID: <20240107160736.14f3ae1d@jic23-huawei> (raw)
In-Reply-To: <20240106153202.54861-1-colin.i.king@gmail.com>

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)


  reply	other threads:[~2024-01-07 16:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2024-01-07 20:18   ` Jean-Baptiste Maneyrol
2024-01-13 15:11     ` Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240107160736.14f3ae1d@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=andy.shevchenko@gmail.com \
    --cc=colin.i.king@gmail.com \
    --cc=jean-baptiste.maneyrol@tdk.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox