Subject: Re: linux-next: build failure after merge of the mm tree

From: Baolin Wang <[email-masked]>
Date: Wed, 11 May 2022 16:42:17 +0800

On 5/11/2022 4:15 PM, Stephen Rothwell wrote:
> Hi all,
> 
> After merging the mm tree, today's linux-next build (sparc64 defconfig)
> failed like this:
> 
> In file included from include/linux/hugetlb.h:757,
>                   from arch/sparc/mm/hugetlbpage.c:11:
> arch/sparc/include/asm/hugetlb.h: In function 'huge_ptep_clear_flush':
> arch/sparc/include/asm/hugetlb.h:27:1: error: no return statement in function returning non-void [-Werror=return-type]
>     27 | }
>        | ^
> 
> (and many more)
> 
> Caused by commit
> 
>    083af99303b9 ("mm: change huge_ptep_clear_flush() to return the original pte")
> 
> I applied the following hack to make it build.
> 
> From: Stephen Rothwell <[email-masked]>
> Date: Wed, 11 May 2022 18:10:56 +1000
> Subject: [PATCH] fix up for "mm: change huge_ptep_clear_flush() to return the original pte"
> 
> Signed-off-by: Stephen Rothwell <[email-masked]>

Sorry again. I think I also missed other ARCHs' changes. Need include 
below fixes.

diff --git a/arch/ia64/include/asm/hugetlb.h 
b/arch/ia64/include/asm/hugetlb.h
index 65d3811..026ead4 100644
--- a/arch/ia64/include/asm/hugetlb.h
+++ b/arch/ia64/include/asm/hugetlb.h
@@ -26,6 +26,7 @@ static inline int is_hugepage_only_range(struct 
mm_struct *mm,
  static inline pte_t huge_ptep_clear_flush(struct vm_area_struct *vma,
                                           unsigned long addr, pte_t *ptep)
  {
+       return *ptep;
  }

  #include <asm-generic/hugetlb.h>
diff --git a/arch/parisc/include/asm/hugetlb.h 
b/arch/parisc/include/asm/hugetlb.h
index 25bc560..f7f078c 100644
--- a/arch/parisc/include/asm/hugetlb.h
+++ b/arch/parisc/include/asm/hugetlb.h
@@ -31,6 +31,7 @@ static inline int prepare_hugepage_range(struct file 
*file,
  static inline pte_t huge_ptep_clear_flush(struct vm_area_struct *vma,
                                           unsigned long addr, pte_t *ptep)
  {
+       return *ptep;
  }

  #define __HAVE_ARCH_HUGE_PTEP_SET_WRPROTECT
diff --git a/arch/sh/include/asm/hugetlb.h b/arch/sh/include/asm/hugetlb.h
index e727cc9..4d3ba39 100644
--- a/arch/sh/include/asm/hugetlb.h
+++ b/arch/sh/include/asm/hugetlb.h
@@ -24,6 +24,7 @@ static inline int prepare_hugepage_range(struct file 
*file,
  static inline pte_t huge_ptep_clear_flush(struct vm_area_struct *vma,
                                           unsigned long addr, pte_t *ptep)
  {
+       return *ptep;
  }

  static inline void arch_clear_hugepage_flags(struct page *page)
diff --git a/arch/sparc/include/asm/hugetlb.h 
b/arch/sparc/include/asm/hugetlb.h
index b50aa6f..0a26cca 100644
--- a/arch/sparc/include/asm/hugetlb.h
+++ b/arch/sparc/include/asm/hugetlb.h
@@ -24,6 +24,7 @@ pte_t huge_ptep_get_and_clear(struct mm_struct *mm, 
unsigned long addr,
  static inline pte_t huge_ptep_clear_flush(struct vm_area_struct *vma,
                                           unsigned long addr, pte_t *ptep)
  {
+       return *ptep;
  }

  #define __HAVE_ARCH_HUGE_PTEP_SET_WRPROTECT

> ---
>   arch/sparc/include/asm/hugetlb.h | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/arch/sparc/include/asm/hugetlb.h b/arch/sparc/include/asm/hugetlb.h
> index b50aa6f8f9ab..0a26cca24232 100644
> --- a/arch/sparc/include/asm/hugetlb.h
> +++ b/arch/sparc/include/asm/hugetlb.h
> @@ -24,6 +24,7 @@ pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr,
>   static inline pte_t huge_ptep_clear_flush(struct vm_area_struct *vma,
>   					  unsigned long addr, pte_t *ptep)
>   {
> +	return *ptep;
>   }
>   
>   #define __HAVE_ARCH_HUGE_PTEP_SET_WRPROTECT