Skip to content

Commit 24c567f

Browse files
Dan Carpenterjgunthorpe
authored andcommitted
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: 2280740 ("IB/hfi1: Virtual Network Interface Controller (VNIC) HW support") Fixes: 4730f4a ("IB/hfi1: Activate the dummy netdev") Link: https://lore.kernel.org/r/20200530140224.GA1330098@mwanda Signed-off-by: Dan Carpenter <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent 4d12c04 commit 24c567f

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

drivers/infiniband/hw/hfi1/vnic_main.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -457,13 +457,19 @@ static int hfi1_vnic_up(struct hfi1_vnic_vport_info *vinfo)
457457
if (rc < 0)
458458
return rc;
459459

460-
hfi1_netdev_rx_init(dd);
460+
rc = hfi1_netdev_rx_init(dd);
461+
if (rc)
462+
goto err_remove;
461463

462464
netif_carrier_on(netdev);
463465
netif_tx_start_all_queues(netdev);
464466
set_bit(HFI1_VNIC_UP, &vinfo->flags);
465467

466468
return 0;
469+
470+
err_remove:
471+
hfi1_netdev_remove_data(dd, VNIC_ID(vinfo->vesw_id));
472+
return rc;
467473
}
468474

469475
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)
512518
goto txreq_fail;
513519
}
514520

515-
if (hfi1_netdev_rx_init(dd)) {
521+
rc = hfi1_netdev_rx_init(dd);
522+
if (rc) {
516523
dd_dev_err(dd, "Unable to initialize netdev contexts\n");
517524
goto alloc_fail;
518525
}

0 commit comments

Comments
 (0)