dm: enclose complex macros into parentheses where possible
authorHeinz Mauelshagen <heinzm@redhat.com>
Wed, 1 Feb 2023 20:51:04 +0000 (21:51 +0100)
committerMike Snitzer <snitzer@kernel.org>
Tue, 14 Feb 2023 19:23:06 +0000 (14:23 -0500)
Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
drivers/md/dm-log.c
include/linux/device-mapper.h

index b57790e..7c3f30c 100644 (file)
@@ -773,8 +773,10 @@ static region_t core_get_sync_count(struct dm_dirty_log *log)
 }
 
 #define        DMEMIT_SYNC \
-       if (lc->sync != DEFAULTSYNC) \
-               DMEMIT("%ssync ", lc->sync == NOSYNC ? "no" : "")
+       do { \
+               if (lc->sync != DEFAULTSYNC) \
+                       DMEMIT("%ssync ", lc->sync == NOSYNC ? "no" : ""); \
+       } while (0);
 
 static int core_status(struct dm_dirty_log *log, status_type_t status,
                       char *result, unsigned int maxlen)
index 9881e77..aa68267 100644 (file)
@@ -613,8 +613,7 @@ void dm_destroy_crypto_profile(struct blk_crypto_profile *profile);
 #define DMDEBUG(fmt, ...) pr_debug(DM_FMT(fmt), ##__VA_ARGS__)
 #define DMDEBUG_LIMIT(fmt, ...) pr_debug_ratelimited(DM_FMT(fmt), ##__VA_ARGS__)
 
-#define DMEMIT(x...) sz += ((sz >= maxlen) ? \
-                         0 : scnprintf(result + sz, maxlen - sz, x))
+#define DMEMIT(x...) (sz += ((sz >= maxlen) ? 0 : scnprintf(result + sz, maxlen - sz, x)))
 
 #define DMEMIT_TARGET_NAME_VERSION(y) \
                DMEMIT("target_name=%s,target_version=%u.%u.%u", \