Skip to content

Commit

Permalink
net/mlx5e: IPoIB, Add error path in mlx5_rdma_setup_rn
Browse files Browse the repository at this point in the history
Check return value from mlx5e_attach_netdev, add error path on failure.

Fixes: 48935bb ("net/mlx5e: IPoIB, Add netdevice profile skeleton")
Signed-off-by: Aya Levin <ayal@mellanox.com>
Reviewed-by: Feras Daoud <ferasda@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
  • Loading branch information
Aya Levin authored and Saeed Mahameed committed Jul 11, 2019
1 parent 99d31cb commit ef1ce7d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,9 @@ static int mlx5_rdma_setup_rn(struct ib_device *ibdev, u8 port_num,

prof->init(mdev, netdev, prof, ipriv);

mlx5e_attach_netdev(epriv);
err = mlx5e_attach_netdev(epriv);
if (err)
goto detach;
netif_carrier_off(netdev);

/* set rdma_netdev func pointers */
Expand All @@ -714,6 +716,11 @@ static int mlx5_rdma_setup_rn(struct ib_device *ibdev, u8 port_num,

return 0;

detach:
prof->cleanup(epriv);
if (ipriv->sub_interface)
return err;
mlx5e_destroy_mdev_resources(mdev);
destroy_ht:
mlx5i_pkey_qpn_ht_cleanup(netdev);
return err;
Expand Down

0 comments on commit ef1ce7d

Please sign in to comment.