Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1523601

[PATCH] usb: dwc3: avoid empty-body warning

From Arnd Bergmann <arnd@arndb.de>
Newsgroups linux.kernel
Subject [PATCH] usb: dwc3: avoid empty-body warning
Date 2016-11-16 16:40 +0100
Message-ID <sEatz-4HA-3@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


Building with W=1, we get a warning about harmless empty statements:

drivers/usb/dwc3/ep0.c: In function 'dwc3_ep0_handle_intf':
drivers/usb/dwc3/ep0.c:491:4: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]

gcc does not warn about {} here, so maybe use that instead.
Alternatively, the code could be removed entirely as it does
nothing.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
This has been present in the driver for a while, but the code
just moved around, so it showed up as a new warning for me.
I hope to eventually address all W=1 warnings as they tend to
find real bugs elsewhere and we may as well fix it now that the
code has changed.
---
 drivers/usb/dwc3/ep0.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c
index 2b22ea7263d8..1e93cfc8f88b 100644
--- a/drivers/usb/dwc3/ep0.c
+++ b/drivers/usb/dwc3/ep0.c
@@ -486,12 +486,12 @@ static int dwc3_ep0_handle_intf(struct dwc3 *dwc,
 
 	switch (wValue) {
 	case USB_INTRF_FUNC_SUSPEND:
-		if (wIndex & USB_INTRF_FUNC_SUSPEND_LP)
+		if (wIndex & USB_INTRF_FUNC_SUSPEND_LP) {
 			/* XXX enable Low power suspend */
-			;
-		if (wIndex & USB_INTRF_FUNC_SUSPEND_RW)
+		}
+		if (wIndex & USB_INTRF_FUNC_SUSPEND_RW) {
 			/* XXX enable remote wakeup */
-			;
+		}
 		break;
 	default:
 		ret = -EINVAL;
-- 
2.9.0

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] usb: dwc3: avoid empty-body warning Arnd Bergmann <arnd@arndb.de> - 2016-11-16 16:40 +0100
  Re: [PATCH] usb: dwc3: avoid empty-body warning Felipe Balbi <balbi@kernel.org> - 2016-11-17 12:30 +0100
    Re: [PATCH] usb: dwc3: avoid empty-body warning Arnd Bergmann <arnd@arndb.de> - 2016-11-17 19:10 +0100

csiph-web