Skip to contentSkip to conversation

mm/hmm: fix unused variable warning in hmm_vma_walk_pud

PATCH In review Arnd Bergmann 2 participants 2 messages Mar 6, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm/hmm: fix unused variable warning in hmm_vma_walk_pud

Without CONFIG_HUGETLB_PAGE, the 'vma' variable is never referenced on x86, so we get this warning:

mm/hmm.c: In function 'hmm_vma_walk_pud':
mm/hmm.c:764:25: error: unused variable 'vma' [-Werror=unused-variable]

Remove the local variable by open-coding walk-vma in the only place it is used.

Fixes 1bed8a07a556 ("mm/hmm: allow to mirror vma of a file on a DAX backed filesystem")

---
Andrew, you already took a similar patch from me for a different warning in the same file. Feel free to fold both patches into one if you haven't already forwarded the first patch, or leave them separate. Note that the warnings were introduced by different patches from the same series originally.

---
 mm/hmm.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
mm/hmm.c +1 -2
index c4beb1628cad..c1cbe82d12b5 100644
@@ -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;
 
Signature · 1 line
2.20.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Arnd Bergmann

Without CONFIG_HUGETLB_PAGE, the 'vma' variable is never referenced on x86, so we get this warning:

mm/hmm.c: In function 'hmm_vma_walk_pud':
mm/hmm.c:764:25: error: unused variable 'vma' [-Werror=unused-variable]

Quoted 7 lines

Remove the local variable by open-coding walk-vma in the only place it is used.

Fixes 1bed8a07a556 ("mm/hmm: allow to mirror vma of a file on a DAX backed filesystem")
Quoted 34 lines

---
Andrew, you already took a similar patch from me for a different warning in the same file. Feel free to fold both patches into one if you haven't already forwarded the first patch, or leave them separate. Note that the warnings were introduced by different patches from the same series originally.

---
 mm/hmm.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
mm/hmm.c +1 -2
index c4beb1628cad..c1cbe82d12b5 100644
@@ -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;
 
Signature · 1 line
2.20.0