powerpc/mm: remove warning about ‘type’ being set
PATCH 1/1 powerpc/mm: remove warning about ‘type’ being set
‘type’ is only used when CONFIG_DEBUG_HIGHMEM is set. So add a possibly unused tag to variable. Remove warning treated as error with W=1:
arch/powerpc/mm/highmem.c:59:6: error: variable ‘type’ set but not used [-Werror=unused-but-set-variable]
--- arch/powerpc/mm/highmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/mm/highmem.c +1 -1
@@ -56,7 +56,7 @@ EXPORT_SYMBOL(kmap_atomic_prot);void __kunmap_atomic (void *kvaddr) {unsigned long vaddr = (unsigned long ) kvaddr &PAGE_MASK ; -int type; +int type__maybe_unused ;if (vaddr <__fix_to_virt (FIX_KMAP_END )) {pagefault_enable ();
Signature · 1 line
2.11.0
Le 22/06/2018 à 21:27, Mathieu Malaterre a écrit :
Quoted 4 lines
‘type’ is only used when
CONFIG_DEBUG_HIGHMEMis set. So add a possibly unused tag to variable. Remove warning treated as error with W=1:
arch/powerpc/mm/highmem.c:59:6: error: variable ‘type’ set but not used [-Werror=unused-but-set-variable]
Is type neeeded at all when CONFIG_DEBUG_HIGHMEM is not set ?
The call type = kmap_atomic_idx(); seems useless when CONFIG_DEBUG_HIGHMEM isn't set. Couldn't we just most type definition and setting inside the CONFIG_DEBUG_HIGHMEM {} below ?
Alternatively, maybe you could replace the #ifdef CONFIG_DEBUG_HIGHMEM by an if (IS_ENABLED(CONFIG_DEBUG_HIGHMEM)) ?
Christophe
Quoted 12 lines
Signed-off-by Mathieu Malaterre <[email protected]>--- arch/powerpc/mm/highmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/powerpc/mm/highmem.c +0
-0
arch/powerpc/mm/highmem.c EXPORT_SYMBOL(kmap_atomic_prot); · line 62
Quoted 8 lines
arch/powerpc/mm/highmem.c +1
-1@@ -56,7 +56,7 @@ EXPORT_SYMBOL(kmap_atomic_prot);void __kunmap_atomic (void *kvaddr) {unsigned long vaddr = (unsigned long ) kvaddr &PAGE_MASK ; -int type; +int type__maybe_unused ;if (vaddr <__fix_to_virt (FIX_KMAP_END )) {pagefault_enable ();
---
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
https://www.avast.com/antivirus
Quoted 5 lines · christophe leroy
Le 22/06/2018 =C3=A0 21:27, Mathieu Malaterre a =C3=A9crit :
Quoted 1 line
=E2=80=98type=E2=80=99 is only used when
CONFIG_DEBUG_HIGHMEMis set. S=
o add a possibly
Quoted 3 lines
Quoted 3 lines
unused tag to variable. Remove warning treated as error with W=3D1:
arch/powerpc/mm/highmem.c:59:6: error: variable =E2=80=98type=E2=80=
=99 set but not used [-Werror=3Dunused-but-set-variable]
Quoted 9 lines
Is type neeeded at all when
CONFIG_DEBUG_HIGHMEMis not set ?The call type =3D
kmap_atomic_idx(); seems useless whenCONFIG_DEBUG_HIGHMEMisn't set. Couldn't we just most type definition and setting inside theCONFIG_DEBUG_HIGHMEM{} below ?Alternatively, maybe you could replace the #ifdef
CONFIG_DEBUG_HIGHMEM
by an if (IS_ENABLED(CONFIG_DEBUG_HIGHMEM)) ?
I am not familiar with this code. But starring at other arch implementations (eg. arch/x86/mm/highmem_32.c), it feels like powerpc is skipping pte_clear(&init_mm, vaddr, kmap_pte-idx); unless CONFIG_DEBUG_HIGHMEM=3Dy. Could someone please confirm this is the correct behavior ?
Or else I can rewrite the code a bit like arch/arm/mm/highmem.c which skips set_fixmap_pte(idx, __pte(0)); unless CONFIG_DEBUG_HIGHMEM=3Dy.
Quoted 19 lines
Christophe
Quoted 17 lines
Signed-off-by Mathieu Malaterre <[email protected]>--- arch/powerpc/mm/highmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/powerpc/mm/highmem.c +1
-1@@ -56,7 +56,7 @@ EXPORT_SYMBOL(kmap_atomic_prot);void __kunmap_atomic (void *kvaddr) { unsigned long vaddr =3D (unsigned long) kvaddr & PAGE_MASK; -int type; +int type__maybe_unused ;
Quoted 6 lines
arch/powerpc/mm/highmem.c EXPORT_SYMBOL(kmap_atomic_prot); · line 62
Quoted 3 lines
arch/powerpc/mm/highmem.c +0
-0if (vaddr <__fix_to_virt (FIX_KMAP_END )) {pagefault_enable ();---
L'absence de virus dans ce courrier =C3=A9lectronique a =C3=A9t=C3=A9 v=
=C3=A9rifi=C3=A9e par le logiciel antivirus Avast.
Quoted 2 lines
Michael Ellerman
AppliedQuoted 6 lines · Mathieu Malaterre
‘type’ is only used when
CONFIG_DEBUG_HIGHMEMis set. So add a possibly unused tag to variable. Remove warning treated as error with W=1:
arch/powerpc/mm/highmem.c:59:6: error: variable ‘type’ set but not used [-Werror=unused-but-set-variable]Signed-off-by Mathieu Malaterre <[email protected]>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/fce278af81daf8599f9e94883cbe43
cheers