Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp187076pxu; Thu, 10 Dec 2020 23:02:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJwkOa31tDf03FKihTDdY6KfMUTPp/O9JOnYtAA+vnOce/cnnVGOmrbHIWd6WLeBtX1TU6kl X-Received: by 2002:a05:6402:7d7:: with SMTP id u23mr10264939edy.325.1607670133980; Thu, 10 Dec 2020 23:02:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607670133; cv=none; d=google.com; s=arc-20160816; b=Or2XQSNZkpopE+YGHcv676iIoO0s9DxiglO1yeLptJBECH9g7tUpXbUvXsk+dg4NN1 612JuRpXqMNF2HeOMFBrW4dwr8G4qY2I4Pk75prvl87RMRsxLHV42RRXb02Mv5THO2kp 5xbW8hLsbPrIb0X+/itz8LykcN1LY/6VaK7ri9OM+O6d42v2FuoXz1g5OlqE314S5wuW 4ELeQyEQKsbm1selkFgcxE6qFPTW1JzGtZkbd5CXWJwrqMiJHxWOYhMVDtsqpY9PJEr0 14LIcz0WAAWAf/7wcbW12Bo5MbSrwrOaztFntQGbxP8QWMA8Hth3WvMtxxcSPP1uNgbM 9lnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=BpWSg8j6NsRxwBl7eK0MduSVEpUvrUGeQfDzH/JBScg=; b=fKw8T8194Yg3h6D72vomKbnMP0akDfJS2tSV7dh0Rf86L7JgiZh+8EZWjwmxvs0YyX x8hUchjAW+c73/YAR9k7p40SClNruhg7Sd95IaGlfwey9HKW5PdBfhKJhOLxAUYxHK7h tGcK4UjYzAXce2SygVUEhFoMhYPCnNI/nLC1FyQEoEQM7FIVgG3/g7X9qbNOsmZ0YvEf 0z4+y6k8iZZvVWAIGFIUn7/+uN6ESYWJ7XDTBLpPwC9pke0GeDAeW2v8B8Ec/+CnISMI jrVRGNS5aWt0ZalSjykxXaxxVd0/rjIBl7A5xTTf07ASc2zExrpWze5ipmO1vIIXrPso XUfQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id de12si4257302edb.421.2020.12.10.23.01.50; Thu, 10 Dec 2020 23:02:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389583AbgLJPLg (ORCPT + 99 others); Thu, 10 Dec 2020 10:11:36 -0500 Received: from relay8-d.mail.gandi.net ([217.70.183.201]:47615 "EHLO relay8-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732352AbgLJPLT (ORCPT ); Thu, 10 Dec 2020 10:11:19 -0500 X-Originating-IP: 86.194.74.19 Received: from localhost (lfbn-lyo-1-997-19.w86-194.abo.wanadoo.fr [86.194.74.19]) (Authenticated sender: alexandre.belloni@bootlin.com) by relay8-d.mail.gandi.net (Postfix) with ESMTPSA id E3ED01BF217; Thu, 10 Dec 2020 15:10:35 +0000 (UTC) Date: Thu, 10 Dec 2020 16:10:35 +0100 From: Alexandre Belloni To: Markus Elfring Cc: linux-mmc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Ludovic Desroches , Nicolas Ferre , Ulf Hansson , LKML , kernel-janitors@vger.kernel.org Subject: Re: [PATCH] mmc: atmel-mci: =?utf-8?Q?Redu?= =?utf-8?Q?ce_scope_for_the_variable_=E2=80=9Cslot?= =?utf-8?B?4oCd?= in atmci_request_end() Message-ID: <20201210151035.GC1578121@piout.net> References: <466b4c6d-032f-fbcc-58ac-75f6f39d734f@web.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <466b4c6d-032f-fbcc-58ac-75f6f39d734f@web.de> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, On 10/12/2020 16:01:44+0100, Markus Elfring wrote: > From: Markus Elfring > Date: Thu, 10 Dec 2020 15:56:13 +0100 > > A local variable was used only within an if branch. > Thus move the definition for the variable “slot” into the corresponding > code block. > What is the improvement here? This makes the code harder to read. > This issue was detected by using the Coccinelle software. > > Signed-off-by: Markus Elfring > --- > drivers/mmc/host/atmel-mci.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c > index 444bd3a0a922..6a0d999ee82e 100644 > --- a/drivers/mmc/host/atmel-mci.c > +++ b/drivers/mmc/host/atmel-mci.c > @@ -1558,7 +1558,6 @@ static void atmci_request_end(struct atmel_mci *host, struct mmc_request *mrq) > __releases(&host->lock) > __acquires(&host->lock) > { > - struct atmel_mci_slot *slot = NULL; > struct mmc_host *prev_mmc = host->cur_slot->mmc; > > WARN_ON(host->cmd || host->data); > @@ -1579,8 +1578,9 @@ static void atmci_request_end(struct atmel_mci *host, struct mmc_request *mrq) > host->cur_slot->mrq = NULL; > host->mrq = NULL; > if (!list_empty(&host->queue)) { > - slot = list_entry(host->queue.next, > - struct atmel_mci_slot, queue_node); > + struct atmel_mci_slot *slot = list_entry(host->queue.next, > + struct atmel_mci_slot, > + queue_node); > list_del(&slot->queue_node); > dev_vdbg(&host->pdev->dev, "list not empty: %s is next\n", > mmc_hostname(slot->mmc)); > -- > 2.29.2 > -- Alexandre Belloni, Bootlin Embedded Linux and Kernel engineering https://bootlin.com