[PATCH] atm: solos-pci: Use pointer from memcpy() call for assignment in fpga_tx()

From
Markus Elfring <hidden>
Date
2025-10-31 11:42:27
Also in
kernel-janitors, lkml
From: Markus Elfring <redacted>
Date: Fri, 31 Oct 2025 12:30:38 +0100

A pointer was assigned to a variable. The same pointer was used for
the destination parameter of a memcpy() call.
This function is documented in the way that the same value is returned.
Thus convert two separate statements into a direct variable assignment for
the return value from a memory copy action.

The source code was transformed by using the Coccinelle software.

Signed-off-by: Markus Elfring <redacted>
---
 drivers/atm/solos-pci.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c
index d3c30a28c410..dc4aa803f3d6 100644
--- a/drivers/atm/solos-pci.c
+++ b/drivers/atm/solos-pci.c
@@ -1087,10 +1087,11 @@ static uint32_t fpga_tx(struct solos_card *card)
 				oldskb = skb; /* We're done with this skb already */
 			} else if (skb && card->using_dma) {
 				unsigned char *data = skb->data;
-				if ((unsigned long)data & card->dma_alignment) {
-					data = card->dma_bounce + (BUF_SIZE * port);
-					memcpy(data, skb->data, skb->len);
-				}
+
+				if ((unsigned long)data & card->dma_alignment)
+					data = memcpy(card->dma_bounce + (BUF_SIZE * port),
+						      skb->data, skb->len);
+
 				SKB_CB(skb)->dma_addr = dma_map_single(&card->dev->dev, data,
 								       skb->len, DMA_TO_DEVICE);
 				card->tx_skb[port] = skb;
-- 
2.51.1
Thread (2 messages) 2 messages, 2 authors, last reply 2025-11-03
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help