]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
x86/pat: Fix W=1 build warning when the within_inclusive() function is unused
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Tue, 11 Feb 2025 14:57:21 +0000 (16:57 +0200)
committerIngo Molnar <mingo@kernel.org>
Fri, 21 Feb 2025 15:35:49 +0000 (16:35 +0100)
The within_inclusive() function, in some cases, when CONFIG_X86_64=n,
may be not used.

This, in particular, prevents kernel builds with Clang, `make W=1`
and CONFIG_WERROR=y:

  arch/x86/mm/pat/set_memory.c:215:1: error: unused function 'within_inclusive' [-Werror,-Wunused-function]

Fix this by guarding the definitions with the respective ifdeffery.

See also:

  6863f5643dd7 ("kbuild: allow Clang to find unused static inline functions for W=1 build")

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20250211145721.1620552-1-andriy.shevchenko@linux.intel.com
arch/x86/mm/pat/set_memory.c

index 7bd0f62ba48fdc19b587d4b818f609691cae1f55..84d0bca3be285da34da49e7dc466cd34d99bde01 100644 (file)
@@ -225,14 +225,14 @@ within(unsigned long addr, unsigned long start, unsigned long end)
        return addr >= start && addr < end;
 }
 
+#ifdef CONFIG_X86_64
+
 static inline int
 within_inclusive(unsigned long addr, unsigned long start, unsigned long end)
 {
        return addr >= start && addr <= end;
 }
 
-#ifdef CONFIG_X86_64
-
 /*
  * The kernel image is mapped into two places in the virtual address space
  * (addresses without KASLR, of course):