Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+4 −1
Original line number Original line Diff line number Diff line
@@ -125,7 +125,10 @@ static u8 alloc_token(struct mlx5_cmd *cmd)
	u8 token;
	u8 token;


	spin_lock(&cmd->token_lock);
	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);
	spin_unlock(&cmd->token_lock);


	return token;
	return token;