Skip to content

Commit a183086

Browse files
Li Zetaokuba-moo
authored andcommitted
tipc: use min() to simplify the code
When calculating size of own domain based on number of peers, the result should be less than MAX_MON_DOMAIN, so using min() here is very semantic. Signed-off-by: Li Zetao <[email protected]> Reviewed-by: Simon Horman <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 26549da commit a183086

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/tipc/monitor.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ static int dom_size(int peers)
149149

150150
while ((i * i) < peers)
151151
i++;
152-
return i < MAX_MON_DOMAIN ? i : MAX_MON_DOMAIN;
152+
return min(i, MAX_MON_DOMAIN);
153153
}
154154

155155
static void map_set(u64 *up_map, int i, unsigned int v)

0 commit comments

Comments
 (0)