aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorHeinz Mauelshagen <heinzm@redhat.com>2023-02-01 21:51:04 +0100
committerMike Snitzer <snitzer@kernel.org>2023-02-14 14:23:06 -0500
commit44bc08ed63db7a852bd1ba16611b700ee666091c (patch)
tree842dc421decce78fcca824722fe7c71422a3ed4e
parentdm: avoid assignment in if conditions (diff)
downloadwireguard-linux-44bc08ed63db7a852bd1ba16611b700ee666091c.tar.xz
wireguard-linux-44bc08ed63db7a852bd1ba16611b700ee666091c.zip
dm: enclose complex macros into parentheses where possible
Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@kernel.org>
-rw-r--r--drivers/md/dm-log.c6
-rw-r--r--include/linux/device-mapper.h3
2 files changed, 5 insertions, 4 deletions
diff --git a/drivers/md/dm-log.c b/drivers/md/dm-log.c
index b57790e62484..7c3f30c58785 100644
--- a/drivers/md/dm-log.c
+++ b/drivers/md/dm-log.c
@@ -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)
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index 9881e772b68c..aa68267bc36f 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -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", \