Skip to content

Commit

Permalink
staging: greybus: eclose macro in a do - while loop
Browse files Browse the repository at this point in the history
" ERROR: Macros with multiple statements should be enclosed in a do -
while loop"

Reported by checkpath.

do loop with the conditional expression set to a constant
value of zero (0).This creates a loop that
will execute exactly one time.This is a coding idiom that
allows a multi-line macro to be used anywhere
that a single statement can be used.

So, enclose `gb_loopback_stats_attrs` macro in do - while (0) to
fix checkpath error

Signed-off-by: Menna Mahmoud <eng.mennamahmoud.mm@gmail.com>
  • Loading branch information
engMennaMahmoud authored and intel-lab-lkp committed Mar 11, 2023
1 parent 466123c commit a0856cd
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions drivers/staging/greybus/loopback.c
Expand Up @@ -162,10 +162,12 @@ 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)
#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); \
} while (0)

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

0 comments on commit a0856cd

Please sign in to comment.