[PATCH 1/2] mm, cma: fix 32-bit warning
From: Arnd Bergmann
Date: Mon Feb 24 2025 - 09:16:19 EST
From: Arnd Bergmann <arnd@xxxxxxxx>
clang warns about certain always-true conditions, like this one on 32-bit
builds:
mm/cma.c:420:13: error: result of comparison of constant 4294967296 with expression of type 'phys_addr_t' (aka 'unsigned int') is always true [-Werror,-Wtautological-constant-out-of-range-compare]
420 | if (start < SZ_4G)
| ~~~~~ ^ ~~~~~
Replace this one with an equivalent expression that does not cause a warning.
Fixes: 4765deffa0f7 ("mm, cma: support multiple contiguous ranges, if requested")
Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
---
mm/cma.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/cma.c b/mm/cma.c
index 34a4df29af72..ef0206c0f16d 100644
--- a/mm/cma.c
+++ b/mm/cma.c
@@ -417,7 +417,7 @@ int __init cma_declare_contiguous_multi(phys_addr_t total_size,
* Create a list of ranges above 4G, largest range first.
*/
for_each_free_mem_range(i, nid, MEMBLOCK_NONE, &start, &end, NULL) {
- if (start < SZ_4G)
+ if (upper_32_bits(start) == 0)
continue;
start = ALIGN(start, align);
--
2.39.5