From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Dorine Tipo <dorine.a.tipo@gmail.com>
Cc: Bryan O'Donoghue <pure.logic@nexus-software.ie>,
Johan Hovold <johan@kernel.org>, Alex Elder <elder@kernel.org>,
greybus-dev@lists.linaro.org, linux-staging@lists.linux.dev,
Shuah Khan <skhan@linuxfoundation.org>,
Javier Carrasco <javier.carrasco.cruz@gmail.com>
Subject: Re: [PATCH] staging: greybus: Enclose multi-statement Macro in a do-while loop
Date: Mon, 26 Aug 2024 10:36:53 +0200 [thread overview]
Message-ID: <2024082639-direction-ibuprofen-729c@gregkh> (raw)
In-Reply-To: <20240826083213.23499-1-dorine.a.tipo@gmail.com>
On Mon, Aug 26, 2024 at 08:32:12AM +0000, Dorine Tipo wrote:
> Update the gb_loopback_stats_attrs() macro to use a do-while(0) loop.
> This ensures that it is treated as a single statement, preventing
> potential issues when used in conditional or loop constructs.
>
> Signed-off-by: Dorine Tipo <dorine.a.tipo@gmail.com>
> ---
> drivers/staging/greybus/loopback.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/staging/greybus/loopback.c b/drivers/staging/greybus/loopback.c
> index 1f19323b0e1a..0f3e4c43e2de 100644
> --- a/drivers/staging/greybus/loopback.c
> +++ b/drivers/staging/greybus/loopback.c
> @@ -163,9 +163,11 @@ static ssize_t name##_avg_show(struct device *dev, \
> static DEVICE_ATTR_RO(name##_avg)
>
> #define gb_loopback_stats_attrs(field) \
> - gb_loopback_ro_stats_attr(field, min, u); \
> - gb_loopback_ro_stats_attr(field, max, u); \
> - gb_loopback_ro_avg_attr(field)
> + do {
> + gb_loopback_ro_stats_attr(field, min, u); \
> + gb_loopback_ro_stats_attr(field, max, u); \
> + gb_loopback_ro_avg_attr(field);
> + } while (0)
>
Please always test-build your patches before sending them out :(
prev parent reply other threads:[~2024-08-26 8:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-26 8:32 [PATCH] staging: greybus: Enclose multi-statement Macro in a do-while loop Dorine Tipo
2024-08-26 8:36 ` Greg Kroah-Hartman [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=2024082639-direction-ibuprofen-729c@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=dorine.a.tipo@gmail.com \
--cc=elder@kernel.org \
--cc=greybus-dev@lists.linaro.org \
--cc=javier.carrasco.cruz@gmail.com \
--cc=johan@kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=pure.logic@nexus-software.ie \
--cc=skhan@linuxfoundation.org \
/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