Re: [PATCH] mm/hmm: fix unused variable warnings

From: Arnd Bergmann
Date: Wed Mar 06 2019 - 05:19:33 EST


On Wed, Mar 6, 2019 at 12:51 AM John Hubbard <jhubbard@xxxxxxxxxx> wrote:
>
> With some Kconfig local hacks that removed all HUGE* support, while leaving
> HMM enabled, I was able to reproduce your results, and also to verify the
> fix. It also makes sense from reading it.

Thanks for the confirmation.

> Also, I ran into one more warning as well:
>
> mm/hmm.c: In function âhmm_vma_walk_pudâ:
> mm/hmm.c:764:25: warning: unused variable âvmaâ [-Wunused-variable]
> struct vm_area_struct *vma = walk->vma;
> ^~~
>
> ...which can be fixed like this:
>
> diff --git a/mm/hmm.c b/mm/hmm.c
> index c4beb1628cad..c1cbe82d12b5 100644
> --- a/mm/hmm.c
> +++ b/mm/hmm.c
> @@ -761,7 +761,6 @@ static int hmm_vma_walk_pud(pud_t *pudp,
> {
> struct hmm_vma_walk *hmm_vma_walk = walk->private;
> struct hmm_range *range = hmm_vma_walk->range;
> - struct vm_area_struct *vma = walk->vma;
> unsigned long addr = start, next;
> pmd_t *pmdp;
> pud_t pud;
> @@ -807,7 +806,7 @@ static int hmm_vma_walk_pud(pud_t *pudp,
> return 0;
> }
>
> - split_huge_pud(vma, pudp, addr);
> + split_huge_pud(walk->vma, pudp, addr);
> if (pud_none(*pudp))
> goto again;
>
> ...so maybe you'd like to fold that into your patch?

I also ran into this one last night during further randconfig testing,
and came up with the same patch that you showed here. I'll
send this one to Andrew and add a Reported-by line for you,
since he already merged the first patch.

I'll leave it up to Andrew to fold the fixes into one, or into the original
patches if he thinks that makes sense.

Arnd