mlxsw: spectrum: Fix refcount bug on span entries
commit9092bbd64bd91d4cd08f9221368913f8cbec2a40
authorYotam Gigi <yotamg@mellanox.com>
Fri, 11 Nov 2016 15:34:25 +0000 (11 16:34 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 21 Nov 2016 09:11:36 +0000 (21 10:11 +0100)
treed23f20c66c63488e11702fc2814ba00270e43e18
parent5712922773b59684c943c52d4925e4fb25c26c8c
mlxsw: spectrum: Fix refcount bug on span entries

[ Upstream commit 2d644d4c7506646f9c4a2afceb7fd5f030bc0c9f ]

When binding port to a newly created span entry, its refcount is
initialized to zero even though it has a bound port. That leads
to unexpected behaviour when the user tries to delete that port
from the span entry.

Fix this by initializing the reference count to 1.

Also add a warning to put function.

Fixes: 763b4b70afcd ("mlxsw: spectrum: Add support in matchall mirror TC offloading")
Signed-off-by: Yotam Gigi <yotamg@mellanox.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/mellanox/mlxsw/spectrum.c