All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mmc: atmel-mci: Reduce scope for the variable “slot” in atmci_request_end()
@ 2020-12-10 15:01 Markus Elfring
  2020-12-10 15:10   ` [PATCH] mmc: atmel-mci: Reduce scope for the variable “slot =?u Alexandre Belloni
  0 siblings, 1 reply; 35+ messages in thread
From: Markus Elfring @ 2020-12-10 15:01 UTC (permalink / raw)
  To: linux-mmc, linux-arm-kernel, Alexandre Belloni,
	Ludovic Desroches, Nicolas Ferre, Ulf Hansson
  Cc: kernel-janitors, LKML

From: Markus Elfring <elfring@users.sourceforge.net>
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.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 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


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 35+ messages in thread

end of thread, other threads:[~2020-12-14 11:01 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-10 15:01 [PATCH] mmc: atmel-mci: Reduce scope for the variable “slot” in atmci_request_end() Markus Elfring
2020-12-10 15:10 ` Alexandre Belloni
2020-12-10 15:10   ` Alexandre Belloni
2020-12-10 15:10   ` [PATCH] mmc: atmel-mci: Reduce scope for the variable “slot =?u Alexandre Belloni
2020-12-10 16:35   ` [PATCH] mmc: atmel-mci: Reduce scope for the variable “slot” in atmci_request_end() Markus Elfring
2020-12-10 17:07     ` Alexandre Belloni
2020-12-10 17:07       ` Alexandre Belloni
2020-12-10 17:07       ` [PATCH] mmc: atmel-mci: Reduce scope for the variable “slot =?u Alexandre Belloni
2020-12-10 17:23       ` [PATCH] mmc: atmel-mci: Reduce scope for the variable “slot” in atmci_request_end() Markus Elfring
2020-12-10 18:21         ` Alexandre Belloni
2020-12-10 18:21           ` Alexandre Belloni
2020-12-10 18:21           ` [PATCH] mmc: atmel-mci: Reduce scope for the variable “slot =?u Alexandre Belloni
2020-12-11  6:34           ` mmc: atmel-mci: Reduce scope for the variable “slot” in atmci_request_end() Markus Elfring
2020-12-11  8:03             ` Alexandre Belloni
2020-12-11  8:03               ` Alexandre Belloni
2020-12-11  8:03               ` mmc: atmel-mci: Reduce scope for the variable “slot” in Alexandre Belloni
2020-12-12  9:16               ` mmc: atmel-mci: Reduce scope for the variable “slot” in atmci_request_end() Joe Perches
2020-12-12  9:16                 ` Joe Perches
2020-12-12  9:16                 ` mmc: atmel-mci: Reduce scope for the variable “slot” in atmci_reques Joe Perches
2020-12-12 11:00                 ` mmc: atmel-mci: Reduce scope for the variable “slot” in atmci_request_end() Markus Elfring
2020-12-12 13:17                 ` Alexandre Belloni
2020-12-12 13:17                   ` Alexandre Belloni
2020-12-12 13:17                   ` mmc: atmel-mci: Reduce scope for the variable “slot” in Alexandre Belloni
2020-12-12 18:48                   ` mmc: atmel-mci: Reduce scope for the variable “slot” in atmci_request_end() Joe Perches
2020-12-12 18:48                     ` Joe Perches
2020-12-12 18:48                     ` mmc: atmel-mci: Reduce scope for the variable “slot” in atmci_reques Joe Perches
2020-12-11  8:37   ` [PATCH] mmc: atmel-mci: Reduce scope for the variable “slot” in atmci_request_end() Dan Carpenter
2020-12-11  8:37     ` Dan Carpenter
2020-12-11  8:37     ` [PATCH] mmc: atmel-mci: Reduce scope for the variable “slot =?u Dan Carpenter
2020-12-11  9:08     ` mmc: atmel-mci: Reduce scope for the variable “slot” in atmci_request_end() Markus Elfring
2020-12-14  7:05       ` Dan Carpenter
2020-12-14  7:05         ` Dan Carpenter
2020-12-14  7:05         ` mmc: atmel-mci: Reduce scope for the variable “slot” in Dan Carpenter
2020-12-14 10:27         ` …: Reduce scope for the variable “…” in …() Markus Elfring
2020-12-14 10:27           ` [dm-devel] " Markus Elfring

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.