public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] arm64: hugetlbpage: avoid unused-but-set-parameter warning (gcc-16)
@ 2026-02-03 16:21 Arnd Bergmann
  2026-02-03 18:17 ` Catalin Marinas
  0 siblings, 1 reply; 3+ messages in thread
From: Arnd Bergmann @ 2026-02-03 16:21 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon
  Cc: Arnd Bergmann, Anshuman Khandual, Ryan Roberts, linux-arm-kernel,
	linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

gcc-16 warns about an instance that older compilers did not:

arch/arm64/mm/hugetlbpage.c: In function 'huge_pte_clear':
arch/arm64/mm/hugetlbpage.c:369:57: error: parameter 'addr' set but not used [-Werror=unused-but-set-parameter=]

The issue here is that __pte_clear() does not actually use its second
argument when CONFIG_ARM64_CONTPTE is disabled.

Reword this to compute the offset each time instead of updating the
argument variable. I checked that the resulting object code is
unchanged.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm64/mm/hugetlbpage.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c
index a42c05cf5640..4ad7662e8323 100644
--- a/arch/arm64/mm/hugetlbpage.c
+++ b/arch/arm64/mm/hugetlbpage.c
@@ -374,8 +374,8 @@ void huge_pte_clear(struct mm_struct *mm, unsigned long addr,
 
 	ncontig = num_contig_ptes(sz, &pgsize);
 
-	for (i = 0; i < ncontig; i++, addr += pgsize, ptep++)
-		__pte_clear(mm, addr, ptep);
+	for (i = 0; i < ncontig; i++, ptep++)
+		__pte_clear(mm, addr + pgsize*i, ptep);
 }
 
 pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr,
-- 
2.39.5



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-02-03 18:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-03 16:21 [PATCH] arm64: hugetlbpage: avoid unused-but-set-parameter warning (gcc-16) Arnd Bergmann
2026-02-03 18:17 ` Catalin Marinas
2026-02-03 18:23   ` Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox