diff options
author | Ido Schimmel <idosch@mellanox.com> | 2016-06-20 23:04:18 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-06-21 05:02:50 -0400 |
commit | 56918b6b0a66e449b3e11adb3e1c93849964d429 (patch) | |
tree | 3c1757e69013d63dfa2fb14e1bed0128b78b7cf4 /drivers/net/ethernet/mellanox/mlxsw/spectrum.h | |
parent | 41b996cc94c7e7f8567585d05ea1d52a3a181146 (diff) | |
download | op-kernel-dev-56918b6b0a66e449b3e11adb3e1c93849964d429.zip op-kernel-dev-56918b6b0a66e449b3e11adb3e1c93849964d429.tar.gz |
mlxsw: spectrum: Don't count on FID being present
Not all vPorts will have FIDs assigned to them, so make sure functions
first test for FID presence.
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlxsw/spectrum.h')
-rw-r--r-- | drivers/net/ethernet/mellanox/mlxsw/spectrum.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h index a6dd295..f419535 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h @@ -290,7 +290,7 @@ mlxsw_sp_vport_br_get(const struct mlxsw_sp_port *mlxsw_sp_vport) { struct mlxsw_sp_fid *f = mlxsw_sp_vport_fid_get(mlxsw_sp_vport); - return f->dev; + return f ? f->dev : NULL; } static inline struct mlxsw_sp_port * @@ -317,7 +317,7 @@ mlxsw_sp_port_vport_find_by_fid(const struct mlxsw_sp_port *mlxsw_sp_port, vport.list) { struct mlxsw_sp_fid *f = mlxsw_sp_vport_fid_get(mlxsw_sp_vport); - if (f->fid == fid) + if (f && f->fid == fid) return mlxsw_sp_vport; } |