[PATCH] Bluetooth: btmrvl_sdio: Use pointer from memcpy() call for assignment in btmrvl_sdio_host_to_card()

Markus Elfring posted 1 patch 3 months, 1 week ago
drivers/bluetooth/btmrvl_sdio.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH] Bluetooth: btmrvl_sdio: Use pointer from memcpy() call for assignment in btmrvl_sdio_host_to_card()
Posted by Markus Elfring 3 months, 1 week ago
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 31 Oct 2025 12:59:00 +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 <elfring@users.sourceforge.net>
---
 drivers/bluetooth/btmrvl_sdio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/bluetooth/btmrvl_sdio.c b/drivers/bluetooth/btmrvl_sdio.c
index 93932a0d8625..3120d2beeaa8 100644
--- a/drivers/bluetooth/btmrvl_sdio.c
+++ b/drivers/bluetooth/btmrvl_sdio.c
@@ -1111,8 +1111,8 @@ static int btmrvl_sdio_host_to_card(struct btmrvl_private *priv,
 		tmpbuf = kzalloc(tmpbufsz, GFP_KERNEL);
 		if (!tmpbuf)
 			return -ENOMEM;
-		buf = (u8 *) ALIGN_ADDR(tmpbuf, BTSDIO_DMA_ALIGN);
-		memcpy(buf, payload, nb);
+
+		buf = memcpy((u8 *)ALIGN_ADDR(tmpbuf, BTSDIO_DMA_ALIGN), payload, nb);
 	}
 
 	sdio_claim_host(card->func);
-- 
2.51.1