[PATCH] linux/bits.h: Squash unsigned comparison warning for GENMASK
From: Yazen Ghannam
Date: Mon Feb 03 2025 - 13:44:33 EST
Invert conditionals to avoid the following 'type-limits' warning:
warning: comparison of unsigned expression in ‘< 0’ is always false
The warning is enabled with W=2 and is present on GCC.
Signed-off-by: Yazen Ghannam <yazen.ghannam@xxxxxxx>
---
include/linux/bits.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/bits.h b/include/linux/bits.h
index 61a75d3f294b..45f70fb56ac3 100644
--- a/include/linux/bits.h
+++ b/include/linux/bits.h
@@ -21,7 +21,7 @@
#if !defined(__ASSEMBLY__)
#include <linux/build_bug.h>
#include <linux/compiler.h>
-#define GENMASK_INPUT_CHECK(h, l) BUILD_BUG_ON_ZERO(const_true((l) > (h)))
+#define GENMASK_INPUT_CHECK(h, l) BUILD_BUG_ON_ZERO(const_true(!((l) < (h))))
#else
/*
* BUILD_BUG_ON_ZERO is not available in h files included from asm files,
--
2.43.0