Re: [PATCH v2] sparc: Avoid -Wunused-but-set-parameter in clear_user_page()
From: Andrew Morton
Date: Mon May 25 2026 - 16:39:57 EST
On Mon, 25 May 2026 21:48:14 +0200 Thomas Weißschuh <linux@xxxxxxxxxxxxxx> wrote:
> On 2026-05-25 10:44:39-0700, Andrew Morton wrote:
> > On Mon, 25 May 2026 10:36:21 +0200 Thomas Weißschuh <linux@xxxxxxxxxxxxxx> wrote:
> >
> > > The loop in clear_user_pages() iterates over all pages and calls
> > > clear_user_page() for each of them. During the loop "vaddr" is modified.
> > > However on sparc clear_user() is a macro which does not use "vaddr".
> > > The compiler sees a variable which is modified but never used and emits
> > > a warning for that:
> > >
> > > include/linux/highmem.h: In function 'clear_user_pages':
> > > include/linux/highmem.h:234:63: warning: parameter 'vaddr' set but not used [-Wunused-but-set-parameter=]
> > > static inline void clear_user_pages(void *addr, unsigned long vaddr,
> > >
> > > Other architectures use an inline function for clear_user_page() which
> > > avoids the warning. This is not possible on sparc, as
> > > sparc_flush_page_to_ram() is not yet declared where clear_user_page() is
> > > defined. Including cacheflush_32.h will trigger recursive and lots of
> > > other issues.
> > >
> > > So hide the warning with a cast to (void) instead.
> > >
> > > While we are here, do the same for copy_user_page().
> >
> > A pleasing solution to these sorts of problems is often "don't use
> > macros". Other architectures use inlined C for these functions - will
> > that work for sparc?
>
> Probably yes. But it would require a major reshuffling of the header
> files to get the dependencies right. So I went with the easy solution to
> avoid a lot of churn. As I tried to explain this in the patch message.
Oh, OK, thanks, reading skills, sorry for noise.