All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] powerpc/64s: Fix get_hugepd_cache_index() build failure
@ 2024-03-06 12:58 Michael Ellerman
  2024-03-06 12:58 ` [PATCH 2/3] powerpc/83xx: Fix build failure with FPU=n Michael Ellerman
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Michael Ellerman @ 2024-03-06 12:58 UTC (permalink / raw)
  To: linuxppc-dev

With CONFIG_BUG=n, the 64-bit Book3S build fails with:

  arch/powerpc/include/asm/book3s/64/pgtable-64k.h: In function 'get_hugepd_cache_index':
  arch/powerpc/include/asm/book3s/64/pgtable-64k.h:51:1: error: no return statement in function returning non-void

Currently the body of the function is just BUG(), so when CONFIG_BUG=n
it is an empty function, leading to the error.

get_hugepd_cache_index() should never be called, the only call is behind
an is_hugepd() check, which is always false for this configuration.

Instead mark it as always inline, and change the BUG() to BUILD_BUG().
That should allow the compiler to see that the function is never called,
and therefore that it never returns, fixing the build error.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
 arch/powerpc/include/asm/book3s/64/pgtable-64k.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/include/asm/book3s/64/pgtable-64k.h b/arch/powerpc/include/asm/book3s/64/pgtable-64k.h
index 2fce3498b000..ced7ee8b42fc 100644
--- a/arch/powerpc/include/asm/book3s/64/pgtable-64k.h
+++ b/arch/powerpc/include/asm/book3s/64/pgtable-64k.h
@@ -45,9 +45,9 @@ static inline int hugepd_ok(hugepd_t hpd)
 /*
  * This should never get called
  */
-static inline int get_hugepd_cache_index(int index)
+static __always_inline int get_hugepd_cache_index(int index)
 {
-	BUG();
+	BUILD_BUG();
 }
 
 #endif /* CONFIG_HUGETLB_PAGE */
-- 
2.43.2


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

end of thread, other threads:[~2024-03-13 13:30 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-06 12:58 [PATCH 1/3] powerpc/64s: Fix get_hugepd_cache_index() build failure Michael Ellerman
2024-03-06 12:58 ` [PATCH 2/3] powerpc/83xx: Fix build failure with FPU=n Michael Ellerman
2024-03-06 12:58 ` [PATCH 3/3] macintosh/ams: Fix unused variable warning Michael Ellerman
2024-03-06 13:17   ` Christophe Leroy
2024-03-07  5:32     ` Michael Ellerman
2024-03-07  6:29       ` Christophe Leroy
2024-03-13 13:19 ` (subset) [PATCH 1/3] powerpc/64s: Fix get_hugepd_cache_index() build failure Michael Ellerman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.