From: Joe Perches <joe@perches.com>
To: Corentin Labbe <clabbe@baylibre.com>,
gregkh@linuxfoundation.org, stern@rowland.harvard.edu
Cc: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org
Subject: Re: [PATCH] usb: Replace empty define with do while
Date: Thu, 07 Jun 2018 13:16:45 -0700 [thread overview]
Message-ID: <685aee141a45b09c46089a8bc777a037261ab447.camel@perches.com> (raw)
In-Reply-To: <1528401911-5263-1-git-send-email-clabbe@baylibre.com>
On Thu, 2018-06-07 at 20:05 +0000, Corentin Labbe wrote:
> 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)"
I also suggest renaming COUNT to something more
intelligible like INCR as the uses are all for
incrementing variables that may not exist.
> 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 */
prev parent reply other threads:[~2018-06-07 20:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-07 20:05 Corentin Labbe
2018-06-07 20:16 ` Joe Perches [this message]
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=685aee141a45b09c46089a8bc777a037261ab447.camel@perches.com \
--to=joe@perches.com \
--cc=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®