Skip to content

Commit

Permalink
tipc: use min() to simplify the code
Browse files Browse the repository at this point in the history
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 <lizetao1@huawei.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20240822133908.1042240-8-lizetao1@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Li Zetao authored and Jakub Kicinski committed Aug 26, 2024
1 parent 26549da commit a183086
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/tipc/monitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ static int dom_size(int peers)

while ((i * i) < peers)
i++;
return i < MAX_MON_DOMAIN ? i : MAX_MON_DOMAIN;
return min(i, MAX_MON_DOMAIN);
}

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

0 comments on commit a183086

Please sign in to comment.