Skip to contentSkip to conversation

sh: W=1 warning fixes in fbdev

PATCH New Sam Ravnborg 2 participants 4 messages Dec 8, 2020 SuperH

lore
Share & tools
lore
#0 lore raw

v4 cover sh: W=1 warning fixes in fbdev

In certain configurations the current definition of iounmap() caused set-but-not-used warnings.

This is fixed by casting the input parameter with (void).

The sole patch included here was a part of a larger video/fbdev/ set of patches. This explains the "v4" tag.

Yoshinori san and Rich - please apply to the sh tree.

Sam

Sam Ravnborg (1):
sh: Fix set but not used warnings with !CONFIG_MMU

 arch/sh/include/asm/io.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
#1 lore raw

PATCH 1/1 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

Cc kernel test robot <[email protected]>
Cc Thomas Zimmermann <[email protected]>
Cc Lee Jones <[email protected]>
Cc Rich Felker <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Geert Uytterhoeven <[email protected]>
Cc Mike Rapoport <[email protected]>
Cc Kuninori Morimoto <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Sam Ravnborg <[email protected]>
Cc Andrew Morton <[email protected]>
---
 arch/sh/include/asm/io.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/sh/include/asm/io.h +1 -1
index 6d5c6463bc07..45082bcbd9aa 100644
@@ -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 */
 
Signature · 1 line
2.27.0
Acked-by on v1 1/1
#2 lore raw

Re: [PATCH] sh: Fix set but not used warnings with !CONFIG_MMU

Am 08.12.20 um 19:21 schrieb Sam Ravnborg:

Quoted 15 lines

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

Quoted 12 lines
Cc kernel test robot <[email protected]>
Cc Thomas Zimmermann <[email protected]>
Cc Lee Jones <[email protected]>
Cc Rich Felker <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Geert Uytterhoeven <[email protected]>
Cc Mike Rapoport <[email protected]>
Cc Kuninori Morimoto <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Sam Ravnborg <[email protected]>
Cc Andrew Morton <[email protected]>
Quoted 18 lines
---
  arch/sh/include/asm/io.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
arch/sh/include/asm/io.h +1 -1
index 6d5c6463bc07..45082bcbd9aa 100644
@@ -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 */
 
Signature · 6 lines
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer
#3 lore raw

Re: [PATCH] sh: Fix set but not used warnings with !CONFIG_MMU

Hi Thomas.

Quoted 31 lines · Thomas Zimmermann

Am 08.12.20 um 19:21 schrieb Sam Ravnborg:

Quoted 15 lines

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

Quoted 12 lines
Cc kernel test robot <[email protected]>
Cc Thomas Zimmermann <[email protected]>
Cc Lee Jones <[email protected]>
Cc Rich Felker <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Geert Uytterhoeven <[email protected]>
Cc Mike Rapoport <[email protected]>
Cc Kuninori Morimoto <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Sam Ravnborg <[email protected]>
Cc Andrew Morton <[email protected]>
Quoted 1 line

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

Sam