All of lore.kernel.org
 help / color / mirror / Atom feed
From: Corentin Labbe <clabbe@baylibre.com>
To: gregkh@linuxfoundation.org, stern@rowland.harvard.edu
Cc: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
	Corentin Labbe <clabbe@baylibre.com>
Subject: [PATCH] usb: Replace empty define with do while
Date: Thu,  7 Jun 2018 20:05:11 +0000	[thread overview]
Message-ID: <1528401911-5263-1-git-send-email-clabbe@baylibre.com> (raw)

It's dangerous to use empty code define.
Furthermore it lead to the following warning:
"suggest braces around empty body in an « else » statement"

So let's replace emptyness by "do {} while(0)"

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
---
 drivers/usb/host/ehci.h    | 2 +-
 drivers/usb/host/fotg210.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
index c8e9a48e1d51..a60d91eac771 100644
--- a/drivers/usb/host/ehci.h
+++ b/drivers/usb/host/ehci.h
@@ -237,7 +237,7 @@ struct ehci_hcd {			/* one per controller */
 	struct ehci_stats	stats;
 #	define COUNT(x) ((x)++)
 #else
-#	define COUNT(x)
+#	define COUNT(x) do {} while (0)
 #endif
 
 	/* debug files */
diff --git a/drivers/usb/host/fotg210.h b/drivers/usb/host/fotg210.h
index 7fcd785c7bc8..dca46d04e288 100644
--- a/drivers/usb/host/fotg210.h
+++ b/drivers/usb/host/fotg210.h
@@ -179,7 +179,7 @@ struct fotg210_hcd {			/* one per controller */
 	struct fotg210_stats	stats;
 #	define COUNT(x) ((x)++)
 #else
-#	define COUNT(x)
+#	define COUNT(x) do {} while (0)
 #endif
 
 	/* debug files */
-- 
2.16.4

WARNING: multiple messages have this Message-ID (diff)
From: Corentin Labbe <clabbe@baylibre.com>
To: gregkh@linuxfoundation.org, stern@rowland.harvard.edu
Cc: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
	Corentin Labbe <clabbe@baylibre.com>
Subject: usb: Replace empty define with do while
Date: Thu,  7 Jun 2018 20:05:11 +0000	[thread overview]
Message-ID: <1528401911-5263-1-git-send-email-clabbe@baylibre.com> (raw)

It's dangerous to use empty code define.
Furthermore it lead to the following warning:
"suggest braces around empty body in an « else » statement"

So let's replace emptyness by "do {} while(0)"

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
---
 drivers/usb/host/ehci.h    | 2 +-
 drivers/usb/host/fotg210.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
index c8e9a48e1d51..a60d91eac771 100644
--- a/drivers/usb/host/ehci.h
+++ b/drivers/usb/host/ehci.h
@@ -237,7 +237,7 @@ struct ehci_hcd {			/* one per controller */
 	struct ehci_stats	stats;
 #	define COUNT(x) ((x)++)
 #else
-#	define COUNT(x)
+#	define COUNT(x) do {} while (0)
 #endif
 
 	/* debug files */
diff --git a/drivers/usb/host/fotg210.h b/drivers/usb/host/fotg210.h
index 7fcd785c7bc8..dca46d04e288 100644
--- a/drivers/usb/host/fotg210.h
+++ b/drivers/usb/host/fotg210.h
@@ -179,7 +179,7 @@ struct fotg210_hcd {			/* one per controller */
 	struct fotg210_stats	stats;
 #	define COUNT(x) ((x)++)
 #else
-#	define COUNT(x)
+#	define COUNT(x) do {} while (0)
 #endif
 
 	/* debug files */

             reply	other threads:[~2018-06-07 20:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-07 20:05 Corentin Labbe [this message]
2018-06-07 20:05 ` usb: Replace empty define with do while Corentin Labbe
2018-06-07 20:16 ` [PATCH] " Joe Perches
2018-06-07 20:16   ` Joe Perches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1528401911-5263-1-git-send-email-clabbe@baylibre.com \
    --to=clabbe@baylibre.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.