diff mbox series

[v3,05/13] sh: Fix set but not used warnings with !CONFIG_MMU

Message ID 20201206190247.1861316-6-sam@ravnborg.org (mailing list archive)
State New, archived
Headers show
Series drivers/video: W=1 warning fixes | expand

Commit Message

Sam Ravnborg Dec. 6, 2020, 7:02 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.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
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

kernel test robot Dec. 6, 2020, 9:19 p.m. UTC | #1
Hi Sam,

I love your patch! Yet something to improve:

[auto build test ERROR on next-20201204]
[also build test ERROR on v5.10-rc6]
[cannot apply to tegra-drm/drm/tegra/for-next soc/for-next linus/master drm/drm-next v5.10-rc6 v5.10-rc5 v5.10-rc4]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Sam-Ravnborg/drivers-video-W-1-warning-fixes/20201207-030414
base:    2996bd3f6ca9ea529b40c369a94b247657abdb4d
config: sh-allmodconfig (attached as .config)
compiler: sh4-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/9c4170037512dc3810cd88f57e3c3a442304b7cf
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Sam-Ravnborg/drivers-video-W-1-warning-fixes/20201207-030414
        git checkout 9c4170037512dc3810cd88f57e3c3a442304b7cf
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=sh 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   In file included from include/linux/io.h:13,
                    from include/linux/irq.h:20,
                    from include/asm-generic/hardirq.h:17,
                    from arch/sh/include/asm/hardirq.h:9,
                    from include/linux/hardirq.h:10,
                    from include/linux/interrupt.h:11,
                    from drivers/net/ethernet/xircom/xirc2ps_cs.c:74:
   drivers/net/ethernet/xircom/xirc2ps_cs.c: In function 'xirc2ps_release':
>> arch/sh/include/asm/io.h:274:29: error: void value not ignored as it ought to be
     274 | #define iounmap(addr)  do { (void)addr; } while (0)
   drivers/net/ethernet/xircom/xirc2ps_cs.c:935:4: note: in expansion of macro 'iounmap'
     935 |    iounmap(local->dingo_ccr - 0x0800);
         |    ^~~~~~~

vim +274 arch/sh/include/asm/io.h

   272	
   273	#else /* CONFIG_MMU */
 > 274	#define iounmap(addr)		do { (void)addr; } while (0)
   275	#define ioremap(offset, size)	((void __iomem *)(unsigned long)(offset))
   276	#endif /* CONFIG_MMU */
   277	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Sam Ravnborg Dec. 6, 2020, 9:48 p.m. UTC | #2
commit aa1f4345b5480502a4e61addf5c59d606fdbce8f
Author: Sam Ravnborg <sam@ravnborg.org>
Date:   Mon Nov 30 22:09:29 2020 +0100

    sh: Fix set but not used warnings with !CONFIG_MMU
    
    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>

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. 6, 2020, 9:49 p.m. UTC | #3
Hi "kernel test robot"
On Sun, Dec 06, 2020 at 10:48:14PM +0100, Sam Ravnborg wrote:
> commit aa1f4345b5480502a4e61addf5c59d606fdbce8f
> Author: Sam Ravnborg <sam@ravnborg.org>
> Date:   Mon Nov 30 22:09:29 2020 +0100
> 
>     sh: Fix set but not used warnings with !CONFIG_MMU
>     
>     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

Thanks for thee quick report - it was easy to reproduce.
I hope this is enough for the robot to pick up the updated patch.

	Sam
Thomas Zimmermann Dec. 7, 2020, 8:19 a.m. UTC | #4
Am 06.12.20 um 20:02 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.
> 
> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
> 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..5ad56c6c1e1e 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 */
>   
>
diff mbox series

Patch

diff --git a/arch/sh/include/asm/io.h b/arch/sh/include/asm/io.h
index 6d5c6463bc07..5ad56c6c1e1e 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 */