blob: 2af6bee0debe1c8a6114fd11ae9cf96d88e7d0fa [file] [log] [blame]
From: Arnd Bergmann <arnd@arndb.de>
Subject: mm, cma: fix 32-bit warning
Date: Mon, 24 Feb 2025 15:07:35 +0100
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.
Link: https://lkml.kernel.org/r/20250224141120.1240534-1-arnd@kernel.org
Fixes: 4765deffa0f7 ("mm, cma: support multiple contiguous ranges, if requested")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Zi Yan <ziy@nvidia.com>
Acked-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Frank van der Linden <fvdl@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/cma.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/mm/cma.c~mm-cma-support-multiple-contiguous-ranges-if-requested-fix
+++ a/mm/cma.c
@@ -378,7 +378,7 @@ int __init cma_declare_contiguous_multi(
* 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);
_