Commit 24c567ff authored by Dan Carpenter's avatar Dan Carpenter Committed by Jason Gunthorpe

IB/hfi1: Fix hfi1_netdev_rx_init() error handling

The hfi1_vnic_up() function doesn't check whether hfi1_netdev_rx_init()
returns errors.  In hfi1_vnic_init() we need to change the code to
preserve the error code instead of returning success.

Fixes: 2280740f ("IB/hfi1: Virtual Network Interface Controller (VNIC) HW support")
Fixes: 4730f4a6 ("IB/hfi1: Activate the dummy netdev")
Link: https://lore.kernel.org/r/20200530140224.GA1330098@mwandaSigned-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent 4d12c04c
...@@ -457,13 +457,19 @@ static int hfi1_vnic_up(struct hfi1_vnic_vport_info *vinfo) ...@@ -457,13 +457,19 @@ static int hfi1_vnic_up(struct hfi1_vnic_vport_info *vinfo)
if (rc < 0) if (rc < 0)
return rc; return rc;
hfi1_netdev_rx_init(dd); rc = hfi1_netdev_rx_init(dd);
if (rc)
goto err_remove;
netif_carrier_on(netdev); netif_carrier_on(netdev);
netif_tx_start_all_queues(netdev); netif_tx_start_all_queues(netdev);
set_bit(HFI1_VNIC_UP, &vinfo->flags); set_bit(HFI1_VNIC_UP, &vinfo->flags);
return 0; return 0;
err_remove:
hfi1_netdev_remove_data(dd, VNIC_ID(vinfo->vesw_id));
return rc;
} }
static void hfi1_vnic_down(struct hfi1_vnic_vport_info *vinfo) static void hfi1_vnic_down(struct hfi1_vnic_vport_info *vinfo)
...@@ -512,7 +518,8 @@ static int hfi1_vnic_init(struct hfi1_vnic_vport_info *vinfo) ...@@ -512,7 +518,8 @@ static int hfi1_vnic_init(struct hfi1_vnic_vport_info *vinfo)
goto txreq_fail; goto txreq_fail;
} }
if (hfi1_netdev_rx_init(dd)) { rc = hfi1_netdev_rx_init(dd);
if (rc) {
dd_dev_err(dd, "Unable to initialize netdev contexts\n"); dd_dev_err(dd, "Unable to initialize netdev contexts\n");
goto alloc_fail; goto alloc_fail;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment