linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc/mm: remove warning about ‘type’ being set
@ 2018-06-22 19:27 Mathieu Malaterre
  2018-06-23 17:12 ` christophe leroy
  2018-08-13 11:23 ` Michael Ellerman
  0 siblings, 2 replies; 4+ messages in thread
From: Mathieu Malaterre @ 2018-06-22 19:27 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: Mathieu Malaterre, Benjamin Herrenschmidt, Paul Mackerras,
	Thomas Gleixner, Greg Kroah-Hartman, Philippe Ombredanne,
	Kate Stewart, linuxppc-dev, linux-kernel

‘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]

Signed-off-by: Mathieu Malaterre <malat@debian.org>
---
 arch/powerpc/mm/highmem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/mm/highmem.c b/arch/powerpc/mm/highmem.c
index 668e87d03f9e..82a0e37557a5 100644
--- a/arch/powerpc/mm/highmem.c
+++ b/arch/powerpc/mm/highmem.c
@@ -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();
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] powerpc/mm: remove warning about ‘type’ being set
  2018-06-22 19:27 [PATCH] powerpc/mm: remove warning about ‘type’ being set Mathieu Malaterre
@ 2018-06-23 17:12 ` christophe leroy
  2018-06-26  6:25   ` Mathieu Malaterre
  2018-08-13 11:23 ` Michael Ellerman
  1 sibling, 1 reply; 4+ messages in thread
From: christophe leroy @ 2018-06-23 17:12 UTC (permalink / raw)
  To: Mathieu Malaterre, Michael Ellerman
  Cc: Kate Stewart, Greg Kroah-Hartman, linux-kernel, Paul Mackerras,
	Philippe Ombredanne, Thomas Gleixner, linuxppc-dev,
	Peter Zijlstra, akpm



Le 22/06/2018 à 21:27, Mathieu Malaterre a écrit :
> ‘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]

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

> 
> Signed-off-by: Mathieu Malaterre <malat@debian.org>
> ---
>   arch/powerpc/mm/highmem.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/mm/highmem.c b/arch/powerpc/mm/highmem.c
> index 668e87d03f9e..82a0e37557a5 100644
> --- a/arch/powerpc/mm/highmem.c
> +++ b/arch/powerpc/mm/highmem.c
> @@ -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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] powerpc/mm: remove warning about ‘type’ being set
  2018-06-23 17:12 ` christophe leroy
@ 2018-06-26  6:25   ` Mathieu Malaterre
  0 siblings, 0 replies; 4+ messages in thread
From: Mathieu Malaterre @ 2018-06-26  6:25 UTC (permalink / raw)
  To: a.p.zijlstra
  Cc: Christophe LEROY, Michael Ellerman, Kate Stewart,
	Greg Kroah-Hartman, LKML, Paul Mackerras, Philippe Ombredanne,
	Thomas Gleixner, linuxppc-dev, Andrew Morton

On Sat, Jun 23, 2018 at 7:12 PM christophe leroy
<christophe.leroy@c-s.fr> wrote:
>
>
>
> Le 22/06/2018 à 21:27, Mathieu Malaterre a écrit :
> > ‘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]
>
> 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)) ?

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=y`. 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=y`.

> Christophe
>
> >
> > Signed-off-by: Mathieu Malaterre <malat@debian.org>
> > ---
> >   arch/powerpc/mm/highmem.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/arch/powerpc/mm/highmem.c b/arch/powerpc/mm/highmem.c
> > index 668e87d03f9e..82a0e37557a5 100644
> > --- a/arch/powerpc/mm/highmem.c
> > +++ b/arch/powerpc/mm/highmem.c
> > @@ -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
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: powerpc/mm: remove warning about ‘type’ being set
  2018-06-22 19:27 [PATCH] powerpc/mm: remove warning about ‘type’ being set Mathieu Malaterre
  2018-06-23 17:12 ` christophe leroy
@ 2018-08-13 11:23 ` Michael Ellerman
  1 sibling, 0 replies; 4+ messages in thread
From: Michael Ellerman @ 2018-08-13 11:23 UTC (permalink / raw)
  To: Mathieu Malaterre
  Cc: Kate Stewart, Greg Kroah-Hartman, Mathieu Malaterre,
	linux-kernel, Paul Mackerras, Philippe Ombredanne,
	Thomas Gleixner, linuxppc-dev

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 488 bytes --]

On Fri, 2018-06-22 at 19:27:47 UTC, Mathieu Malaterre wrote:
> ‘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]
> 
> Signed-off-by: Mathieu Malaterre <malat@debian.org>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/fce278af81daf8599f9e94883cbe43

cheers

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-08-13 11:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-22 19:27 [PATCH] powerpc/mm: remove warning about ‘type’ being set Mathieu Malaterre
2018-06-23 17:12 ` christophe leroy
2018-06-26  6:25   ` Mathieu Malaterre
2018-08-13 11:23 ` Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).