diff mbox series

spi: pl022: Reduce scope for the variable “previous” in pump_transfers()

Message ID ae0ffd6c-5a5b-b6ee-0cc7-385f2789038d@web.de (mailing list archive)
State New, archived
Headers show
Series spi: pl022: Reduce scope for the variable “previous” in pump_transfers() | expand

Commit Message

Markus Elfring Dec. 10, 2020, 3:40 p.m. UTC
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 10 Dec 2020 16:31:00 +0100

A local variable was used only within an if branch.
Thus move the definition for the variable “previous” into
the corresponding code block.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/spi/spi-pl022.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

--
2.29.2
diff mbox series

Patch

diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c
index d1776fea287e..469d8e8b286c 100644
--- a/drivers/spi/spi-pl022.c
+++ b/drivers/spi/spi-pl022.c
@@ -1381,7 +1381,6 @@  static void pump_transfers(unsigned long data)
 	struct pl022 *pl022 = (struct pl022 *) data;
 	struct spi_message *message = NULL;
 	struct spi_transfer *transfer = NULL;
-	struct spi_transfer *previous = NULL;

 	/* Get current state information */
 	message = pl022->cur_msg;
@@ -1403,9 +1402,9 @@  static void pump_transfers(unsigned long data)

 	/* Delay if requested at end of transfer before CS change */
 	if (message->state == STATE_RUNNING) {
-		previous = list_entry(transfer->transfer_list.prev,
-					struct spi_transfer,
-					transfer_list);
+		struct spi_transfer *previous = list_entry(transfer->transfer_list.prev,
+							   struct spi_transfer,
+							   transfer_list);
 		/*
 		 * FIXME: This runs in interrupt context.
 		 * Is this really smart?