Skip to content

Commit

Permalink
x86/pat: Fix W=1 build warning when the within_inclusive() function i…
Browse files Browse the repository at this point in the history
…s unused

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:

  6863f56 ("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
  • Loading branch information
Andy Shevchenko authored and Ingo Molnar committed Feb 21, 2025
1 parent f2c5c21 commit 3fcae77
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions arch/x86/mm/pat/set_memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 3fcae77

Please sign in to comment.