Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933263AbcKCWMa convert rfc822-to-8bit (ORCPT ); Thu, 3 Nov 2016 18:12:30 -0400 Received: from mga06.intel.com ([134.134.136.31]:26245 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932571AbcKCWM3 (ORCPT ); Thu, 3 Nov 2016 18:12:29 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,440,1473145200"; d="scan'208";a="1080298780" From: "Dilger, Andreas" To: Andrew Kanner CC: "Drokin, Oleg" , James Simmons , Greg Kroah-Hartman , Alexander Viro , "bevans@cray.com" , "bhaktipriya96@gmail.com" , "lustre-devel@lists.lustre.org" , "devel@driverdev.osuosl.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] staging: lustre: fixed shadowed variable in socklnd_cb.c Thread-Topic: [PATCH] staging: lustre: fixed shadowed variable in socklnd_cb.c Thread-Index: AQHSNh1OpL97PrPqFk6RfIoekwaJA6DIR9SA Date: Thu, 3 Nov 2016 22:12:26 +0000 Message-ID: References: <1478210059-6091-1-git-send-email-andrew.kanner@gmail.com> In-Reply-To: <1478210059-6091-1-git-send-email-andrew.kanner@gmail.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.252.128.107] Content-Type: text/plain; charset="us-ascii" Content-ID: Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1619 Lines: 42 On Nov 3, 2016, at 15:54, Andrew Kanner wrote: > > Changed variable 'tx' name in local scope > Fixed: sparse warning: > socklnd_cb.c:2476:41: warning: symbol 'tx' shadows an earlier one > socklnd_cb.c:2435:25: originally declared here Looking at this more closely (or from a greater distance, hard to say), the outer-scope "tx" is used only after this inner-scope "tx", so in fact there is no benefit to having the inner-scope declaration at all. Removing it may save a stack variable (depending on how the compiler optimizes), and shouldn't affect functionality. Cheers, Andreas > Signed-off-by: Andrew Kanner > --- > drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c > index c1c6f60..03fe4e5 100644 > --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c > +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c > @@ -2473,11 +2473,11 @@ ksocknal_check_peer_timeouts(int idx) > * holding only shared lock > */ > if (!list_empty(&peer->ksnp_tx_queue)) { > - struct ksock_tx *tx = list_entry(peer->ksnp_tx_queue.next, > + struct ksock_tx *_tx = list_entry(peer->ksnp_tx_queue.next, > struct ksock_tx, tx_list); > > if (cfs_time_aftereq(cfs_time_current(), > - tx->tx_deadline)) { > + _tx->tx_deadline)) { > ksocknal_peer_addref(peer); > read_unlock(&ksocknal_data.ksnd_global_lock); > > -- > 2.1.4 >