* [PATCH] ARM: ecard: Use pointers from memcpy() calls for assignments in ecard_init_pgtables()
@ 2025-10-30 18:56 Markus Elfring
0 siblings, 0 replies; only message in thread
From: Markus Elfring @ 2025-10-30 18:56 UTC (permalink / raw)
To: linux-arm-kernel, Russell King; +Cc: LKML, kernel-janitors, Miaoqian Lin
From: Markus Elfring <elfring@users.sourceforge.net>
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.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
arch/arm/mach-rpc/ecard.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/arch/arm/mach-rpc/ecard.c b/arch/arm/mach-rpc/ecard.c
index 2cde4c83b7f9..879c201b754e 100644
--- a/arch/arm/mach-rpc/ecard.c
+++ b/arch/arm/mach-rpc/ecard.c
@@ -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);
--
2.51.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2025-10-30 18:57 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-30 18:56 [PATCH] ARM: ecard: Use pointers from memcpy() calls for assignments in ecard_init_pgtables() Markus Elfring
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox