arm64: hugetlbpage: avoid unused-but-set-parameter warning (gcc-16)
PATCH v3 1/1 arm64: hugetlbpage: avoid unused-but-set-parameter warning (gcc-16)
From: Arnd Bergmann <[email protected]>
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, but when CONFIG_ARM64_CONTPTE is enabled it still gets updated.
Replace the macro with an inline function to let the compiler see the argument getting passed down.
---
v3: rephrase changelog text
v2: replace my original patch with Catalin's suggestion
--- arch/arm64/include/asm/pgtable.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
arch/arm64/include/asm/pgtable.h +7 -2
@@ -144,8 +144,6 @@ static inline pteval_t __phys_to_pte_val(phys_addr_t phys) __pte(__phys_to_pte_val((phys_addr_t)(pfn) << PAGE_SHIFT) | pgprot_val(prot))#define pte_none (pte) (!pte_val(pte)) -#define __pte_clear (mm, addr, ptep) \ - __set_pte(ptep, __pte(0))#define pte_page (pte) (pfn_to_page(pte_pfn(pte)))/*
@@ -1284,6 +1282,13 @@ static inline bool pud_user_accessible_page(pud_t pud, unsigned long addr)/* * Atomic pte/pmd modifications. */ + +static inline void __pte_clear (struct mm_struct *mm, +unsigned long addr,pte_t *ptep) +{ +__set_pte (ptep,__pte (0 )); +} +static inline int __ptep_test_and_clear_young (struct vm_area_struct *vma,unsigned long address,pte_t *ptep)
Signature · 1 line
2.39.5
Quoted 11 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
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, but whenCONFIG_ARM64_CONTPTEis enabled it still gets updated.
Quoted 6 lines
Replace the macro with an inline function to let the compiler see the argument getting passed down.
Suggested-by Catalin Marinas <[email protected]>Signed-off-by Arnd Bergmann <[email protected]>---
Quoted 33 lines
v3: rephrase changelog text
v2: replace my original patch with Catalin's suggestion--- arch/arm64/include/asm/pgtable.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)arch/arm64/include/asm/pgtable.h +7
-2@@ -144,8 +144,6 @@ static inline pteval_t __phys_to_pte_val(phys_addr_t phys) __pte(__phys_to_pte_val((phys_addr_t)(pfn) << PAGE_SHIFT) | pgprot_val(prot))#define pte_none (pte) (!pte_val(pte)) -#define __pte_clear (mm, addr, ptep) \ - __set_pte(ptep, __pte(0))#define pte_page (pte) (pfn_to_page(pte_pfn(pte)))/* @@ -1284,6 +1282,13 @@ static inline bool pud_user_accessible_page(pud_t pud, unsigned long addr)/* * Atomic pte/pmd modifications. */ + +static inline void __pte_clear (struct mm_struct *mm, +unsigned long addr,pte_t *ptep) +{ +__set_pte (ptep,__pte (0 )); +} +static inline int __ptep_test_and_clear_young (struct vm_area_struct *vma,unsigned long address,pte_t *ptep)
Quoted 10 lines · Arnd Bergmann
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, but whenCONFIG_ARM64_CONTPTEis enabled it still gets updated.[...]
Applied to arm64 (for-next/core), thanks!
[1/1] arm64: hugetlbpage: avoid unused-but-set-parameter warning (gcc-16)
https://git.kernel.org/arm64/c/729a2e8e9ac4
Cheers,
Signature · 5 lines
Will https://fixes.arm64.dev https://next.arm64.dev https://will.arm64.dev