Skip to contentSkip to conversation

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

PATCH New Markus Elfring 1 participant 1 message Dec 10, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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

From: Markus Elfring <[email protected]>
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.

---
 drivers/spi/spi-pl022.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/spi/spi-pl022.c +3 -4
index d1776fea287e..469d8e8b286c 100644
@@ -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?

--
2.29.2

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel