Received: by 2002:a05:7412:98c1:b0:fa:551:50a7 with SMTP id kc1csp1203135rdb; Sun, 7 Jan 2024 08:07:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IERq/DMaCnm4Lelc/e3nJ19VLFm23WR1gKQBvSVQlyEIw8HZbAs1Lw4QIr0usDg3UhEC8Y1 X-Received: by 2002:a05:620a:4610:b0:783:1f95:c843 with SMTP id br16-20020a05620a461000b007831f95c843mr762382qkb.61.1704643675746; Sun, 07 Jan 2024 08:07:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704643675; cv=none; d=google.com; s=arc-20160816; b=JeovTvOKv+a3xPvgEwbylcLQyOOjP0x+pDCaUc04WONkFFSDY5gZDG5wgxdwP5OdbW 2ez6RWgeVSSIT8y5Jj+Jpr/it187Zh5Azi0aRCFS1VS1z6FS2wwXAJRZcaazUFfjdOEP InvETaMByJpq3woNgxIsSZL77mm6P8apTfw8my0yiMJdHmrD4mh2TBAJKgL0znKRwZ+F doz7ro++bh3zBTP7IpEn+aK/k3hkxMLIbZ3oZcAlgtOttcfQ/ifoQYyvU4XYZr5z3t+B bIXxhJ+ZjTO1a1JGOZJBO4ioTq5nQKt2b0wdPG4hXVi+MxBArYjtLr63zRaiAkr27Nfn 4mLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=K5ivOKCycwrQNtwPBpB3ZuHp8/SQ8AGy4wRP9dpAXmY=; fh=yoj2reXtDnL3a+tHXI5Ryp2NcgNQdZiNgiLqEVTjQdM=; b=M4MrqyVcyqgB/r34x4hirXi0/2p6c0c2zrg4x3U9FYVRnbauQ7ZuJVR+lkQFMl2yBC LtjcAQkPIQc+K90Cg+MDlBKF2cO5by6vXWGWTgEDIujxcecDtWYzSQ/9x553L32qll8f rNGuRCCLPYF8vLu9Bl14fJdfE/MSsbVc/kYvITyFbL1x49l6SSnilJDADcQPfsYtER7J RzGFbn1NiIT/1KpXb+govx5o5mwRldZbT/Bm1+jzLiVBZrDXwavdiPG0bpeyFrlyCm1g W7COo4XkWtO95zvZxlPU1LYKiC77eI9KJBsS6HLoayJkVd7XTaom/aOoIeMBAqj6AtZm 02PQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lyQLmV3f; spf=pass (google.com: domain of linux-kernel+bounces-18903-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-18903-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id dt12-20020a05620a478c00b0077fb765a788si2287799qkb.5.2024.01.07.08.07.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Jan 2024 08:07:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-18903-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lyQLmV3f; spf=pass (google.com: domain of linux-kernel+bounces-18903-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-18903-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 2EA5A1C20B19 for ; Sun, 7 Jan 2024 16:07:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id ED4A113ADD; Sun, 7 Jan 2024 16:07:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="lyQLmV3f" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2678E13AC7; Sun, 7 Jan 2024 16:07:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AC203C433C8; Sun, 7 Jan 2024 16:07:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1704643661; bh=irwiB0glJqtkW5oESCUx2inVytpmIwtrLKY8B2VSb7U=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=lyQLmV3fl2YZWdk+11aDymPdtPvyIECQmIjD3cct2tyigiLrV+ZJYslhW46z6o6CM JFjSKGvnSHwCpKoO+SpWMODGqM0nLA479N9H0e4p3sfCdFfg5Gp94iqT3NuLmZHnb5 z9hbf6x0ioRke7ZVI9psr5vnCtTZI5xvdKSbmrWp7VienhV1VcRbgvQ7FTNpNHLJ/d ywm/RVObu0u6tQ+KXyWuFPYzEzmUbejYwx3QOuCNHThlvU5urMO6nwgWNfkpCoX+zX oxfdzGz1XphUo2pHuVqhhS+/UALoEzHX03C7YvDQRTKsXLujGWTijFR9KN+mD2wVFg AtQt8VsXqPYYw== Date: Sun, 7 Jan 2024 16:07:36 +0000 From: Jonathan Cameron To: Colin Ian King Cc: Lars-Peter Clausen , Jean-Baptiste Maneyrol , Andy Shevchenko , 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 Message-ID: <20240107160736.14f3ae1d@jic23-huawei> In-Reply-To: <20240106153202.54861-1-colin.i.king@gmail.com> References: <20240106153202.54861-1-colin.i.king@gmail.com> X-Mailer: Claws Mail 4.2.0 (GTK 3.24.39; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Sat, 6 Jan 2024 15:32:02 +0000 Colin Ian King 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 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)