Skip to contentSkip to conversation

media: flexcop: avoid -Wempty-body warning

PATCH New Arnd Bergmann 1 participant 2 messages Mar 22, 2021 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 media: flexcop: avoid -Wempty-body warning

From: Arnd Bergmann <[email protected]>

Building with 'make W=1' shows many warnings -Wempty-body warnings like

drivers/media/common/b2c2/flexcop-misc.c: In function 'flexcop_determine_revision':
drivers/media/common/b2c2/flexcop-misc.c:35:85: error: suggest braces around empty body in an 'else' statement [-Werror=empty-body]
35 | deb_info("this FlexCop has the 6 basic main hardware pid filter.\n");

drivers/media/usb/b2c2/flexcop-usb.c: In function 'flexcop_usb_process_frame':
drivers/media/usb/b2c2/flexcop-usb.c:357:79: error: suggest braces around empty body in an 'else' statement [-Werror=empty-body]
357 | deb_ts("not ts packet %*ph\n", 4, b+2);
| ^
drivers/media/common/b2c2/flexcop-misc.c: In function 'flexcop_determine_revision':
drivers/media/common/b2c2/flexcop-misc.c:35:85: error: suggest braces around empty body in an 'else' statement [-Werror=empty-body]
35 | deb_info("this FlexCop has the 6 basic main hardware pid filter.\n");
| ^

Change the empty dprintk() macros to no_printk(), which avoids this warning and adds format string checking.

---
 drivers/media/common/b2c2/flexcop.h  | 2 +-
 drivers/media/pci/b2c2/flexcop-pci.c | 2 +-
 drivers/media/usb/b2c2/flexcop-usb.c | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)
drivers/media/common/b2c2/flexcop.h +1 -1
index 486fe2380b92..632d7bb9631a 100644
@@ -17,7 +17,7 @@ extern int b2c2_flexcop_debug;
 #define dprintk(level,args...) \
 	do { if ((b2c2_flexcop_debug & level)) printk(args); } while (0)
 #else
-#define dprintk(level,args...)
+#define dprintk(level,args...) no_printk(args)
 #endif
 
 #define deb_info(args...) dprintk(0x01, args)
drivers/media/pci/b2c2/flexcop-pci.c +1 -1
index a9d9520a94c6..83d0ce7fc80e 100644
@@ -22,7 +22,7 @@ MODULE_PARM_DESC(irq_chk_intv, "set the interval for IRQ streaming watchdog.");
 	do { if ((debug & level)) printk(args); } while (0)
 #define DEBSTATUS ""
 #else
-#define dprintk(level,args...)
+#define dprintk(level,args...) no_printk(args)
 #define DEBSTATUS " (debugging is not enabled)"
 #endif
 
drivers/media/usb/b2c2/flexcop-usb.c +2 -2
index e731243267e4..6f8dc96adc08 100644
@@ -27,8 +27,8 @@
 
 #define DEBSTATUS ""
 #else
-#define dprintk(level, args...)
-#define debug_dump(b, l, method)
+#define dprintk(level, args...) no_printk(args)
+#define debug_dump(b, l, method) do { } while (0)
 #define DEBSTATUS " (debugging is not enabled)"
 #endif
 
Signature · 1 line
2.29.2
#1 lore raw

PATCH 2/2 media: dvb-usb: avoid -Wempty-body warnings

From: Arnd Bergmann <[email protected]>

Building with 'make W=1' shows many warnings -Wempty-body warnings like

drivers/media/usb/dvb-usb/vp702x-fe.c: In function 'vp702x_fe_set_frontend':
drivers/media/usb/dvb-usb/vp702x-fe.c:190:46: error: suggest braces around empty body in an 'else' statement [-Werror=empty-body]
190 | deb_fe("tuning succeeded.\n");
drivers/media/usb/dvb-usb/dtt200u.c: In function 'dtt200u_rc_query':
drivers/media/usb/dvb-usb/dtt200u.c:124:58: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
124 | deb_info("st->data: %*ph\n", 5, st->data);
drivers/media/usb/dvb-usb/m920x.c: In function 'm920x_rc_query':
drivers/media/usb/dvb-usb/m920x.c:207:58: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
207 | deb("Unknown rc key %02x\n", rc_state[1]);

Change the empty dprintk() macros to no_printk(), which avoids this warning and adds format string checking.

---
 drivers/media/usb/dvb-usb/dvb-usb.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/usb/dvb-usb/dvb-usb.h +2 -2
index 2b8ad2bde8a4..42f4d2fece8b 100644
@@ -38,8 +38,8 @@
 }
 #define DVB_USB_DEBUG_STATUS
 #else
-#define dprintk(args...)
-#define debug_dump(b,l,func)
+#define dprintk(var,level,args...) no_printk(args)
+#define debug_dump(b,l,func) do { } while (0)
 
 #define DVB_USB_DEBUG_STATUS " (debugging is not enabled)"
 
Signature · 1 line
2.29.2