Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

fbdev: via: fix -Wextra build warning and format warning

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,

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Antonino Daplas <adaplas@gmail.com>
Cc: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200315041002.24473-7-rdunlap@infradead.org

authored by

Randy Dunlap and committed by
Bartlomiej Zolnierkiewicz
6ce2fc42 1a56b9fa

+5 -3
+4 -2
drivers/video/fbdev/via/debug.h
··· 7 7 #ifndef __DEBUG_H__ 8 8 #define __DEBUG_H__ 9 9 10 + #include <linux/printk.h> 11 + 10 12 #ifndef VIAFB_DEBUG 11 13 #define VIAFB_DEBUG 0 12 14 #endif ··· 16 14 #if VIAFB_DEBUG 17 15 #define DEBUG_MSG(f, a...) printk(f, ## a) 18 16 #else 19 - #define DEBUG_MSG(f, a...) 17 + #define DEBUG_MSG(f, a...) no_printk(f, ## a) 20 18 #endif 21 19 22 20 #define VIAFB_WARN 0 23 21 #if VIAFB_WARN 24 22 #define WARN_MSG(f, a...) printk(f, ## a) 25 23 #else 26 - #define WARN_MSG(f, a...) 24 + #define WARN_MSG(f, a...) no_printk(f, ## a) 27 25 #endif 28 26 29 27 #endif /* __DEBUG_H__ */
+1 -1
drivers/video/fbdev/via/viafbdev.c
··· 1144 1144 if (value != NULL) { 1145 1145 if (kstrtou8(value, 0, &reg_val) < 0) 1146 1146 return -EINVAL; 1147 - DEBUG_MSG(KERN_INFO "DVP0:reg_val[%l]=:%x\n", i, 1147 + DEBUG_MSG(KERN_INFO "DVP0:reg_val[%lu]=:%x\n", i, 1148 1148 reg_val); 1149 1149 switch (i) { 1150 1150 case 0: