summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorAchiad Shochat <achiad@mellanox.com>2015-04-02 17:07:28 +0300
committerDavid S. Miller <davem@davemloft.net>2015-04-02 23:33:42 +0300
commit4cbdd27c9c3abf87d6fe88cdd749218193ed3e12 (patch)
tree50389f99ecb6616592c47c972b4147ad36ceaca2 /drivers
parent21db507439ec3a76a9587f2ad50ad3e4d13f4440 (diff)
downloadlinux-4cbdd27c9c3abf87d6fe88cdd749218193ed3e12.tar.xz
net/mlx5_core: Fix a bug in alloc_token
In alloc_token(), the token '1' would be allocated twice consecutively. Signed-off-by: Achiad Shochat <achiad@mellanox.com> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com> Signed-off-by: Eli Cohen <eli@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/cmd.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
index 0d862696b876..697d538163f2 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
@@ -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;