Skip to contentSkip to conversation

ARM: ecard: Use pointers from memcpy() calls for assignments in ecard_init_pgtables()

PATCH New Markus Elfring 1 participant 1 message Oct 30, 2025

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

PATCH 1/1 ARM: ecard: Use pointers from memcpy() calls for assignments in ecard_init_pgtables()

From: Markus Elfring <[email protected]>
Date: Thu, 30 Oct 2025 19:50:08 +0100

Pointers were assigned to a variable. The same pointer was used for the destination parameter of two memcpy() calls.
This function is documented in the way that the same value is returned. Thus convert separate statements into direct variable assignments for the return values from memory copy actions.

The source code was transformed by using the Coccinelle software.

---
 arch/arm/mach-rpc/ecard.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
arch/arm/mach-rpc/ecard.c +4 -6
index 2cde4c83b7f9..879c201b754e 100644
@@ -229,14 +229,12 @@ static void ecard_init_pgtables(struct mm_struct *mm)
 	pgd_t *src_pgd, *dst_pgd;
 
 	src_pgd = pgd_offset(mm, (unsigned long)IO_BASE);
-	dst_pgd = pgd_offset(mm, IO_START);
-
-	memcpy(dst_pgd, src_pgd, sizeof(pgd_t) * (IO_SIZE / PGDIR_SIZE));
+	dst_pgd = memcpy(pgd_offset(mm, IO_START), src_pgd,
+			 sizeof(pgd_t) * (IO_SIZE / PGDIR_SIZE));
 
 	src_pgd = pgd_offset(mm, (unsigned long)EASI_BASE);
-	dst_pgd = pgd_offset(mm, EASI_START);
-
-	memcpy(dst_pgd, src_pgd, sizeof(pgd_t) * (EASI_SIZE / PGDIR_SIZE));
+	dst_pgd = memcpy(pgd_offset(mm, EASI_START), src_pgd,
+			 sizeof(pgd_t) * (EASI_SIZE / PGDIR_SIZE));
 
 	flush_tlb_range(&vma, IO_START, IO_START + IO_SIZE);
 	flush_tlb_range(&vma, EASI_START, EASI_START + EASI_SIZE);
Signature · 1 line
2.51.1