linux-staging.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: greybus: loopback: enclose macro statements in do-while loop
@ 2022-10-16 14:19 Deepak R Varma
  2022-10-16 14:51 ` Julia Lawall
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Deepak R Varma @ 2022-10-16 14:19 UTC (permalink / raw)
  To: outreachy, pure.logic, johan, elder, gregkh, greybus-dev,
	linux-staging, linux-kernel

Include multiple statements of macro definition inside do-while{0} loop
to avoid possible partial program execution. Issue reported by
checkpatch script:

ERROR: Macros with multiple statements should be enclosed in a do - while loop

Signed-off-by: Deepak R Varma <drv@mailo.com>
---
 drivers/staging/greybus/loopback.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/greybus/loopback.c b/drivers/staging/greybus/loopback.c
index 1a61fce98056..37214cb43937 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)				\
+do {								\
 	gb_loopback_ro_stats_attr(field, min, u);		\
 	gb_loopback_ro_stats_attr(field, max, u);		\
-	gb_loopback_ro_avg_attr(field)
+	gb_loopback_ro_avg_attr(field);				\
+} while (0)

 #define gb_loopback_attr(field, type)					\
 static ssize_t field##_show(struct device *dev,				\
--
2.30.2




^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2022-10-20 15:40 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-16 14:19 [PATCH] staging: greybus: loopback: enclose macro statements in do-while loop Deepak R Varma
2022-10-16 14:51 ` Julia Lawall
2022-10-16 15:02   ` Deepak R Varma
2022-10-16 15:10     ` Julia Lawall
2022-10-16 15:27       ` Deepak R Varma
2022-10-16 15:37         ` Julia Lawall
2022-10-16 15:40         ` Greg KH
2022-10-16 15:50           ` Deepak R Varma
2022-10-19 15:28             ` Deepak R Varma
2022-10-20 15:40               ` Greg KH
2022-10-16 16:14   ` Deepak R Varma
2022-10-16 15:10 ` Greg KH
2022-10-19 15:16 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).