Re: [PATCH] arm64: fix pte_unmap() -Wunused-but-set-variable

From: Qian Cai
Date: Mon Apr 29 2019 - 13:19:00 EST


On Mon, 2019-04-29 at 17:49 +0100, Will Deacon wrote:
> > Âarch/arm64/include/asm/pgtable.h | 4 ++--
> > Â1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/arch/arm64/include/asm/pgtable.h
> > b/arch/arm64/include/asm/pgtable.h
> > index de70c1eabf33..7543e345e078 100644
> > --- a/arch/arm64/include/asm/pgtable.h
> > +++ b/arch/arm64/include/asm/pgtable.h
> > @@ -478,6 +478,8 @@ static inline phys_addr_t pmd_page_paddr(pmd_t pmd)
> > Â return __pmd_to_phys(pmd);
> > Â}
> > Â
> > +static inline void pte_unmap(pte_t *pte) { }
>
> Hmm, is this guaranteed to stop the compiler from warning? Assuming the
> pte_unmap() call is inlined, I'd expect it to keep complaining. What
> compiler are you using?

Yes, it is guaranteed. Tested on both gcc and clang.

>
> Also, there are a bunch of other architectures that I would expect to have
> this same issue because they defined pte_unmap() exactly the same way.

This has already fixed in powerpc that went in.

https://lore.kernel.org/lkml/20190307144031.52494-1-cai@xxxxxx/

I am not sure if I care about any other arches nor I have real hardware to test
further.