Commit 4cbdd27c authored by Achiad Shochat's avatar Achiad Shochat Committed by David S. Miller

net/mlx5_core: Fix a bug in alloc_token

In alloc_token(), the token '1' would be allocated twice consecutively.
Signed-off-by: default avatarAchiad Shochat <achiad@mellanox.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
Signed-off-by: default avatarEli Cohen <eli@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 21db5074
......@@ -125,7 +125,10 @@ static u8 alloc_token(struct mlx5_cmd *cmd)
u8 token;
spin_lock(&cmd->token_lock);
token = cmd->token++ % 255 + 1;
cmd->token++;
if (cmd->token == 0)
cmd->token++;
token = cmd->token;
spin_unlock(&cmd->token_lock);
return token;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment