linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH-next] arm: fix clang build warning in include/asm/memory.h
@ 2024-03-14  7:54 Yipeng Zou
  2024-03-15  0:43 ` Nathan Chancellor
  0 siblings, 1 reply; 10+ messages in thread
From: Yipeng Zou @ 2024-03-14  7:54 UTC (permalink / raw)
  To: linux, nathan, ndesaulniers, morbo, justinstitt, linus.walleij,
	ssantosh, linux-arm-kernel
  Cc: zouyipeng

There is a build error has been founded with build in clang-15.0.4:

./arch/arm/include/asm/memory.h:358:12: error: result of comparison "phys addr_t’ (aka 'unsigned int’) > 4294967295 is always false [-Werror, -Wtautological-type-limit-compare]
                             if (addr > (u32)~0)
                                 ~~~~ ^ ~~~~~~~

It will be always goes fail without CONFIG_PHYS_ADDR_T_64BIT.

Directly silence it by Use CONFIG_PHYS_ADDR_T_64BIT.

Fixes: 981b6714dbd2 ("ARM: provide improved virt_to_idmap() functionality")
Signed-off-by: Yipeng Zou <zouyipeng@huawei.com>
---
 arch/arm/include/asm/memory.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h
index ef2aa79ece5a..64ced9eb42ff 100644
--- a/arch/arm/include/asm/memory.h
+++ b/arch/arm/include/asm/memory.h
@@ -347,14 +347,18 @@ static inline bool arm_has_idmap_alias(void)
 	return IS_ENABLED(CONFIG_MMU) && arch_phys_to_idmap_offset != 0;
 }
 
+#ifdef CONFIG_PHYS_ADDR_T_64BIT
 #define IDMAP_INVALID_ADDR ((u32)~0)
+#endif
 
 static inline unsigned long phys_to_idmap(phys_addr_t addr)
 {
 	if (IS_ENABLED(CONFIG_MMU) && arch_phys_to_idmap_offset) {
 		addr += arch_phys_to_idmap_offset;
+#ifdef CONFIG_PHYS_ADDR_T_64BIT
 		if (addr > (u32)~0)
 			addr = IDMAP_INVALID_ADDR;
+#endif
 	}
 	return addr;
 }
-- 
2.34.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2024-03-19 14:47 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-14  7:54 [PATCH-next] arm: fix clang build warning in include/asm/memory.h Yipeng Zou
2024-03-15  0:43 ` Nathan Chancellor
2024-03-15  7:40   ` Linus Walleij
2024-03-15 10:08     ` Russell King (Oracle)
2024-03-15 13:16       ` Linus Walleij
2024-03-15 14:46         ` Russell King (Oracle)
2024-03-19  3:13     ` Yipeng Zou
2024-03-19  3:16   ` Yipeng Zou
2024-03-19  3:38     ` Yipeng Zou
2024-03-19 14:46       ` Nathan Chancellor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).