Skip to contentSkip to conversation

m32r: mm: fix build warning

PATCH In review Sudip Mukherjee 2 participants 3 messages Feb 14, 2017 – Feb 15, 2017

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

PATCH 1/1 m32r: mm: fix build warning

The build of m32r was giving warning:
mm/pgtable-generic.c: In function 'ptep_clear_flush':
mm/pgtable-generic.c:76:20: warning:
unused variable 'mm' [-Wunused-variable]

The implementation of ptep_get_and_clear() and pte_accessible() does not use 'mm'.

---

build log is at:
https://travis-ci.org/sudipm-mukherjee/parport/jobs/201416051

 mm/pgtable-generic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/pgtable-generic.c +1 -1
index 4ed5908..58f5937 100644
@@ -73,7 +73,7 @@ int ptep_clear_flush_young(struct vm_area_struct *vma,
 pte_t ptep_clear_flush(struct vm_area_struct *vma, unsigned long address,
 		       pte_t *ptep)
 {
-	struct mm_struct *mm = (vma)->vm_mm;
+	struct mm_struct __maybe_unused *mm = (vma)->vm_mm;
 	pte_t pte;
 	pte = ptep_get_and_clear(mm, address, ptep);
 	if (pte_accessible(mm, pte))
Signature · 1 line
2.7.4
maintainer
#1 lore raw
Quoted 7 lines · On Tue, 14 Feb 2017 22:05:45 +0000 Sudip Mukherjee…

The build of m32r was giving warning:
mm/pgtable-generic.c: In function 'ptep_clear_flush':
mm/pgtable-generic.c:76:20: warning:
unused variable 'mm' [-Wunused-variable]

The implementation of ptep_get_and_clear() and pte_accessible() does not use 'mm'.

That's because ptep_get_and_clear() and pte_accessible() are implemented as macros. If they were (static inline) C functions then this warning wouldn't occur. All the other architectures get this right.

#2 lore raw
Quoted 7 lines · Andrew Morton
Quoted 5 lines · On Tue, 14 Feb 2017 22:05:45 +0000 Sudip Mukherjee…

The build of m32r was giving warning:
mm/pgtable-generic.c: In function 'ptep_clear_flush':
mm/pgtable-generic.c:76:20: warning:
unused variable 'mm' [-Wunused-variable]

Quoted 7 lines
Quoted 2 lines

The implementation of ptep_get_and_clear() and pte_accessible() does not use 'mm'.

That's because ptep_get_and_clear() and pte_accessible() are implemented as macros. If they were (static inline) C functions then this warning wouldn't occur. All the other architectures get this right.

oops.. sorry.. usually I will check all the other arch before sending a patch but missed it this time.
Will investigate further today and send you a modified patch.

Regards
Sudip