diff mbox series

sh: Fix set but not used warnings with !CONFIG_MMU

Message ID 20201208182117.163642-2-sam@ravnborg.org (mailing list archive)
State New, archived
Headers show
Series sh: Fix set but not used warnings with !CONFIG_MMU | expand

Commit Message

Sam Ravnborg Dec. 8, 2020, 6:21 p.m. UTC
Building fbdev drivers for sh with W=1 produces the following warning:

    tmiofb.c: In function ‘tmiofb_remove’:
    tmiofb.c:805:21: warning: variable ‘par’ set but not used

This is with allmodconfig and ARCH=sh

This boiled down to iounmap() defined as empty for !CONFIG_MMU.
Fix this by by adding "(void)addr;" to tell the compiler the
argument to iounmap() should be considered used.

v4:
  - Fix build error of ethernet driver (kernel test robot)
    Added missing () around macro parameter

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: kernel test robot <lkp@intel.com>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: Rich Felker <dalias@libc.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
---
 arch/sh/include/asm/io.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Thomas Zimmermann Dec. 8, 2020, 6:52 p.m. UTC | #1
Am 08.12.20 um 19:21 schrieb Sam Ravnborg:
> Building fbdev drivers for sh with W=1 produces the following warning:
> 
>      tmiofb.c: In function ‘tmiofb_remove’:
>      tmiofb.c:805:21: warning: variable ‘par’ set but not used
> 
> This is with allmodconfig and ARCH=sh
> 
> This boiled down to iounmap() defined as empty for !CONFIG_MMU.
> Fix this by by adding "(void)addr;" to tell the compiler the
> argument to iounmap() should be considered used.
> 
> v4:
>    - Fix build error of ethernet driver (kernel test robot)
>      Added missing () around macro parameter
> 
> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
> Cc: kernel test robot <lkp@intel.com>
> Cc: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: Lee Jones <lee.jones@linaro.org>
> Cc: Rich Felker <dalias@libc.org>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Geert Uytterhoeven <geert+renesas@glider.be>
> Cc: Mike Rapoport <rppt@kernel.org>
> Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Sam Ravnborg <sam@ravnborg.org>
> Cc: Andrew Morton <akpm@linux-foundation.org>

Acked-by: Thomas Zimmermann <tzimmermann@suse.de>

> ---
>   arch/sh/include/asm/io.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/sh/include/asm/io.h b/arch/sh/include/asm/io.h
> index 6d5c6463bc07..45082bcbd9aa 100644
> --- a/arch/sh/include/asm/io.h
> +++ b/arch/sh/include/asm/io.h
> @@ -271,7 +271,7 @@ static inline void __iomem *ioremap_prot(phys_addr_t offset, unsigned long size,
>   #endif /* CONFIG_HAVE_IOREMAP_PROT */
>   
>   #else /* CONFIG_MMU */
> -#define iounmap(addr)		do { } while (0)
> +#define iounmap(addr)		do { (void)(addr); } while (0)
>   #define ioremap(offset, size)	((void __iomem *)(unsigned long)(offset))
>   #endif /* CONFIG_MMU */
>   
>
Sam Ravnborg Dec. 8, 2020, 7 p.m. UTC | #2
Hi Thomas.

On Tue, Dec 08, 2020 at 07:52:49PM +0100, Thomas Zimmermann wrote:
> 
> 
> Am 08.12.20 um 19:21 schrieb Sam Ravnborg:
> > Building fbdev drivers for sh with W=1 produces the following warning:
> > 
> >      tmiofb.c: In function ‘tmiofb_remove’:
> >      tmiofb.c:805:21: warning: variable ‘par’ set but not used
> > 
> > This is with allmodconfig and ARCH=sh
> > 
> > This boiled down to iounmap() defined as empty for !CONFIG_MMU.
> > Fix this by by adding "(void)addr;" to tell the compiler the
> > argument to iounmap() should be considered used.
> > 
> > v4:
> >    - Fix build error of ethernet driver (kernel test robot)
> >      Added missing () around macro parameter
> > 
> > Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
> > Cc: kernel test robot <lkp@intel.com>
> > Cc: Thomas Zimmermann <tzimmermann@suse.de>
> > Cc: Lee Jones <lee.jones@linaro.org>
> > Cc: Rich Felker <dalias@libc.org>
> > Cc: Arnd Bergmann <arnd@arndb.de>
> > Cc: Geert Uytterhoeven <geert+renesas@glider.be>
> > Cc: Mike Rapoport <rppt@kernel.org>
> > Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> > Cc: Peter Zijlstra <peterz@infradead.org>
> > Cc: Sam Ravnborg <sam@ravnborg.org>
> > Cc: Andrew Morton <akpm@linux-foundation.org>
> 
> Acked-by: Thomas Zimmermann <tzimmermann@suse.de>

The ack is added in my commit, but I forgot to refresh the patch :-(
Thanks for noticing.

	Sam
diff mbox series

Patch

diff --git a/arch/sh/include/asm/io.h b/arch/sh/include/asm/io.h
index 6d5c6463bc07..45082bcbd9aa 100644
--- a/arch/sh/include/asm/io.h
+++ b/arch/sh/include/asm/io.h
@@ -271,7 +271,7 @@  static inline void __iomem *ioremap_prot(phys_addr_t offset, unsigned long size,
 #endif /* CONFIG_HAVE_IOREMAP_PROT */
 
 #else /* CONFIG_MMU */
-#define iounmap(addr)		do { } while (0)
+#define iounmap(addr)		do { (void)(addr); } while (0)
 #define ioremap(offset, size)	((void __iomem *)(unsigned long)(offset))
 #endif /* CONFIG_MMU */