Skip to contentSkip to conversation

fbdev: fix -Wextra build warnings

PATCH New Randy Dunlap 2 participants 8 messages Mar 15, 2020 – Mar 20, 2020

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

This patch series fixes warnings in fbdev that are found when -Wextra is used. In fixing these, there were a few other build errors discovered (mostly caused by bitrot) and fixed.

[PATCH 1/6] fbdev: fbmon: fix -Wextra build warnings [PATCH 2/6] fbdev: aty: fix -Wextra build warning
[PATCH 3/6] fbdev: matrox: fix -Wextra build warnings [PATCH 4/6] fbdev: savage: fix -Wextra build warning [PATCH 5/6] fbdev: pm[23]fb.c: fix -Wextra build warnings and errors [PATCH 6/6] fbdev: via: fix -Wextra build warning and format warning

 drivers/video/fbdev/aty/atyfb_base.c       |    2 +-
 drivers/video/fbdev/core/fbmon.c           |    2 +-
 drivers/video/fbdev/matrox/matroxfb_base.h |    2 +-
 drivers/video/fbdev/pm2fb.c                |    2 +-
 drivers/video/fbdev/pm3fb.c                |    8 ++++----
 drivers/video/fbdev/savage/savagefb.h      |    2 +-
 drivers/video/fbdev/via/debug.h            |    6 ++++--
 drivers/video/fbdev/via/viafbdev.c         |    2 +-
 8 files changed, 14 insertions(+), 12 deletions(-)
#1 lore raw

PATCH 1/6 fbdev: fbmon: fix -Wextra build warnings

When 'DEBUG' is not defined, modify the DPRINTK() macro to use the no_printk() macro instead of using <empty>.
This fixes a build warning when -Wextra is used and provides printk format checking:

../drivers/video/fbdev/core/fbmon.c:812:47: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body] ../drivers/video/fbdev/core/fbmon.c:842:24: warning: suggest braces around empty body in an ‘else’ statement [-Wempty-body] ../drivers/video/fbdev/core/fbmon.c:847:24: warning: suggest braces around empty body in an ‘else’ statement [-Wempty-body]

---
Alternative: use pr_debug() so that CONFIG_DYNAMIC_DEBUG can be used at these sites.

 drivers/video/fbdev/core/fbmon.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/fbdev/core/fbmon.c +1 -1
@@ -44,7 +44,7 @@
 #ifdef DEBUG
 #define DPRINTK(fmt, args...) printk(fmt,## args)
 #else
-#define DPRINTK(fmt, args...)
+#define DPRINTK(fmt, args...) no_printk(fmt, ##args)
 #endif
 
 #define FBMON_FIX_HEADER  1
#2 lore raw

PATCH 2/6 fbdev: aty: fix -Wextra build warning

In reply to Randy Dunlap

When 'DEBUG' is not defined, modify the DPRINTK() macro to use the no_printk() macro instead of using <empty>.
This fixes a build warning when -Wextra is used and provides printk format checking:

../drivers/video/fbdev/aty/atyfb_base.c:784:61: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body]

---
Alternative: use pr_debug() so that CONFIG_DYNAMIC_DEBUG can be used at these sites.

 drivers/video/fbdev/aty/atyfb_base.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/fbdev/aty/atyfb_base.c +1 -1
@@ -126,7 +126,7 @@
 #ifdef DEBUG
 #define DPRINTK(fmt, args...)	printk(KERN_DEBUG "atyfb: " fmt, ## args)
 #else
-#define DPRINTK(fmt, args...)
+#define DPRINTK(fmt, args...)	no_printk(fmt, ##args)
 #endif
 
 #define PRINTKI(fmt, args...)	printk(KERN_INFO "atyfb: " fmt, ## args)
#3 lore raw

PATCH 3/6 fbdev: matrox: fix -Wextra build warnings

In reply to Randy Dunlap

When 'DEBUG' is not defined, modify the dprintk() macro to use the no_printk() macro instead of using <empty>.
This fixes build warnings when -Wextra is used and provides printk format checking:

../drivers/video/fbdev/matrox/matroxfb_base.c:635:77: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body] ../drivers/video/fbdev/matrox/matroxfb_Ti3026.c:632:54: warning: suggest braces around empty body in an ‘else’ statement [-Wempty-body] ../drivers/video/fbdev/matrox/matroxfb_Ti3026.c:654:53: warning: suggest braces around empty body in an ‘else’ statement [-Wempty-body]

---
Alternative: use pr_debug() so that CONFIG_DYNAMIC_DEBUG can be used at these sites.

 drivers/video/fbdev/matrox/matroxfb_base.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/fbdev/matrox/matroxfb_base.h +1 -1
@@ -86,7 +86,7 @@
 #ifdef DEBUG
 #define dprintk(X...)	printk(X)
 #else
-#define dprintk(X...)
+#define dprintk(X...)	no_printk(X)
 #endif
 
 #ifndef PCI_SS_VENDOR_ID_SIEMENS_NIXDORF
#4 lore raw

PATCH 4/6 fbdev: savage: fix -Wextra build warning

In reply to Randy Dunlap

When 'SAVAGEFB_DEBUG' is not defined, modify the DBG() macro to use the no_printk() macro instead of using <empty>.
This fixes a build warning when -Wextra is used and provides printk format checking:

../drivers/video/fbdev/savage/savagefb_driver.c:2411:13: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body]

Cc Antonino Daplas <[email protected]>
Cc Bartlomiej Zolnierkiewicz <[email protected]>

---
Alternative: use pr_debug() so that CONFIG_DYNAMIC_DEBUG can be used at these sites.

 drivers/video/fbdev/savage/savagefb.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/fbdev/savage/savagefb.h +1 -1
@@ -21,7 +21,7 @@
 #ifdef SAVAGEFB_DEBUG
 # define DBG(x)		printk (KERN_DEBUG "savagefb: %s\n", (x));
 #else
-# define DBG(x)
+# define DBG(x)		no_printk(x)
 # define SavagePrintRegs(...)
 #endif
 
#5 lore raw

PATCH 5/6 fbdev: pm[23]fb.c: fix -Wextra build warnings and errors

In reply to Randy Dunlap

When 'DEBUG' is not defined, modify the DPRINTK() macro to use the no_printk() macro instead of using <empty>.
This fixes build warnings when -Wextra is used and provides printk format checking:

../drivers/video/fbdev/pm2fb.c:227:38: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body] ../drivers/video/fbdev/pm3fb.c:1039:33: warning: suggest braces around empty body in an ‘else’ statement [-Wempty-body]

Also drop one argument in two DPRINTK() macro uses to provide the correct number of arguments and use the correct field in one case to fix a build error:

../drivers/video/fbdev/pm3fb.c:353:9: error: ‘struct fb_info’ has no member named ‘current_par’

     info->current_par->depth);

---
Alternative: use pr_debug() so that CONFIG_DYNAMIC_DEBUG can be used at these sites.

 drivers/video/fbdev/pm2fb.c |    2 +-
 drivers/video/fbdev/pm3fb.c |    8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/video/fbdev/pm2fb.c +1 -1
@@ -54,7 +54,7 @@
 #define DPRINTK(a, b...)	\
 	printk(KERN_DEBUG "pm2fb: %s: " a, __func__ , ## b)
 #else
-#define DPRINTK(a, b...)
+#define DPRINTK(a, b...)	no_printk(a, ##b)
 #endif
 
 #define PM2_PIXMAP_SIZE	(1600 * 4)
drivers/video/fbdev/pm3fb.c +4 -4
@@ -44,7 +44,7 @@
 #define DPRINTK(a, b...)	\
 	printk(KERN_DEBUG "pm3fb: %s: " a, __func__ , ## b)
 #else
-#define DPRINTK(a, b...)
+#define DPRINTK(a, b...)	no_printk(a, ##b)
 #endif
 
 #define PM3_PIXMAP_SIZE	(2048 * 4)
@@ -306,7 +306,7 @@ static void pm3fb_init_engine(struct fb_
 					   PM3PixelSize_GLOBAL_32BIT);
 			break;
 		default:
-			DPRINTK(1, "Unsupported depth %d\n",
+			DPRINTK("Unsupported depth %d\n",
 				info->var.bits_per_pixel);
 			break;
 		}
@@ -349,8 +349,8 @@ static void pm3fb_init_engine(struct fb_
 					   (1 << 10) | (0 << 3));
 			break;
 		default:
-			DPRINTK(1, "Unsupported depth %d\n",
-				info->current_par->depth);
+			DPRINTK("Unsupported depth %d\n",
+				info->var.bits_per_pixel);
 			break;
 		}
 	}
#6 lore raw

PATCH 6/6 fbdev: via: fix -Wextra build warning and format warning

In reply to Randy Dunlap

When 'VIAFB_DEBUG' and 'VIAFB_WARN' are not defined, modify the DEBUG_MSG() &WARN_MSG() macros to use the no_printk() macro instead of using <empty>.
This fixes a build warning when -Wextra is used and provides printk format checking:

../drivers/video/fbdev/via/ioctl.c:88:47: warning: suggest braces around empty body in an ‘else’ statement [-Wempty-body]

Also use %lu to print an unsigned long instead of just %l, to fix a printk format warning:

../drivers/video/fbdev/via/viafbdev.c: In function ‘viafb_dvp0_proc_write’:
../drivers/video/fbdev/via/viafbdev.c:1148:14: warning: unknown conversion type character ‘]’ in format [-Wformat=]

    DEBUG_MSG("DVP0:reg_val[%l]=:%x\n", i,
Cc Florian Tobias Schandinat <[email protected]>
Cc Bartlomiej Zolnierkiewicz <[email protected]>

---
Alternative: use pr_debug() so that CONFIG_DYNAMIC_DEBUG can be used at these sites.

 drivers/video/fbdev/via/debug.h    |    6 ++++--
 drivers/video/fbdev/via/viafbdev.c |    2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)
drivers/video/fbdev/via/debug.h +4 -2
@@ -7,6 +7,8 @@
 #ifndef __DEBUG_H__
 #define __DEBUG_H__
 
+#include <linux/printk.h>
+
 #ifndef VIAFB_DEBUG
 #define VIAFB_DEBUG 0
 #endif
@@ -14,14 +16,14 @@
 #if VIAFB_DEBUG
 #define DEBUG_MSG(f, a...)   printk(f, ## a)
 #else
-#define DEBUG_MSG(f, a...)
+#define DEBUG_MSG(f, a...)   no_printk(f, ## a)
 #endif
 
 #define VIAFB_WARN 0
 #if VIAFB_WARN
 #define WARN_MSG(f, a...)   printk(f, ## a)
 #else
-#define WARN_MSG(f, a...)
+#define WARN_MSG(f, a...)   no_printk(f, ## a)
 #endif
 
 #endif /* __DEBUG_H__ */
drivers/video/fbdev/via/viafbdev.c +1 -1
@@ -1144,7 +1144,7 @@ static ssize_t viafb_dvp0_proc_write(str
 		if (value != NULL) {
 			if (kstrtou8(value, 0, &reg_val) < 0)
 				return -EINVAL;
-			DEBUG_MSG(KERN_INFO "DVP0:reg_val[%l]=:%x\n", i,
+			DEBUG_MSG(KERN_INFO "DVP0:reg_val[%lu]=:%x\n", i,
 				  reg_val);
 			switch (i) {
 			case 0:
#7 lore raw
In reply to Randy Dunlap
Quoted 11 lines · Randy Dunlap

This patch series fixes warnings in fbdev that are found when -Wextra is used. In fixing these, there were a few other build errors discovered (mostly caused by bitrot) and fixed.

[PATCH 1/6] fbdev: fbmon: fix -Wextra build warnings [PATCH 2/6] fbdev: aty: fix -Wextra build warning
[PATCH 3/6] fbdev: matrox: fix -Wextra build warnings [PATCH 4/6] fbdev: savage: fix -Wextra build warning [PATCH 5/6] fbdev: pm[23]fb.c: fix -Wextra build warnings and errors [PATCH 6/6] fbdev: via: fix -Wextra build warning and format warning

Quoted 9 lines
 drivers/video/fbdev/aty/atyfb_base.c       |    2 +-
 drivers/video/fbdev/core/fbmon.c           |    2 +-
 drivers/video/fbdev/matrox/matroxfb_base.h |    2 +-
 drivers/video/fbdev/pm2fb.c                |    2 +-
 drivers/video/fbdev/pm3fb.c                |    8 ++++----
 drivers/video/fbdev/savage/savagefb.h      |    2 +-
 drivers/video/fbdev/via/debug.h            |    6 ++++--
 drivers/video/fbdev/via/viafbdev.c         |    2 +-
 8 files changed, 14 insertions(+), 12 deletions(-)

Patches #1-6 queued for v5.7, thanks!

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics