arm: fix clang build warning in include/asm/memory.h
PATCH v3 1/1 arm: fix clang build warning in include/asm/memory.h
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.
--- arch/arm/include/asm/memory.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
arch/arm/include/asm/memory.h +4 -1
@@ -19,6 +19,7 @@#include <linux/const.h> #include <linux/types.h> #include <linux/sizes.h> +#include <linux/limits.h> #ifdef CONFIG_NEED_MACH_MEMORY_H #include <mach/memory.h>
@@ -353,8 +354,10 @@ 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; -if (addr > (u32 )~0 ) +#ifdef CONFIG_PHYS_ADDR_T_64BIT +if (addr >U32_MAX ) addr =IDMAP_INVALID_ADDR ; +#endif }return addr; }
Signature · 7 lines
2.34.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 6 lines · Yipeng Zou
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) ~~~~ ^ ~~~~~~~
Quoted 7 lines
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 <[email protected]>Reviewed-by Nathan Chancellor <[email protected]>
Excellent, thanks!
Please put this patch into Russell's patch tracker.
Yours,
Linus Walleij
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel