Skip to content

Commit

Permalink
fix: riscv: mm: call test_and_clear_bit uses a type cast
Browse files Browse the repository at this point in the history
arch/riscv/mm/pgtable.c: In function 'ptep_test_and_clear_young':
arch/riscv/mm/pgtable.c:27:51: error: passing argument 2 of 'test_and_clear_bit' from incompatible pointer type [-Werror=incompatible-pointer-types]
   27 |  return test_and_clear_bit(_PAGE_ACCESSED_OFFSET, &pte_val(*ptep));
In file included from ./include/linux/bitops.h:68,
                 from ./include/linux/thread_info.h:27,
                 from ./include/asm-generic/preempt.h:5,
                 from ./arch/riscv/include/generated/asm/preempt.h:1,
                 from ./include/linux/preempt.h:79,
                 from ./include/linux/spinlock.h:56,
                 from ./include/linux/mmzone.h:8,
                 from ./include/linux/gfp.h:7,
                 from ./include/linux/mm.h:7,
                 from ./arch/riscv/include/asm/pgalloc.h:10,
                 from arch/riscv/mm/pgtable.c:3:
./arch/riscv/include/asm/bitops.h:83:70: note: expected 'volatile long unsigned int *' but argument is of type 'u64 *' {aka 'long long unsigned int *'}
   83 | static inline int test_and_clear_bit(int nr, volatile unsigned long *addr)
      |                                              ~~~~~~~~~~~~~~~~~~~~~~~~^~~~
cc1: some warnings being treated as errors
make[8]: *** [scripts/Makefile.build:243: arch/riscv/mm/pgtable.o] Error 1

Signed-off-by: Han Gao <[email protected]>
Signed-off-by: Han Gao <[email protected]>
  • Loading branch information
RevySR committed Aug 12, 2024
1 parent 460c5e7 commit 34d93ac
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/riscv/mm/pgtable.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ int ptep_test_and_clear_young(struct vm_area_struct *vma,
{
if (!pte_young(ptep_get(ptep)))
return 0;
return test_and_clear_bit(_PAGE_ACCESSED_OFFSET, &pte_val(*ptep));
return test_and_clear_bit(_PAGE_ACCESSED_OFFSET, (unsigned long *)&pte_val(*ptep));
}
EXPORT_SYMBOL_GPL(ptep_test_and_clear_young);

Expand Down

0 comments on commit 34d93ac

Please sign in to comment.