Skip to content

Commit a5e099e

Browse files
Kalesh APjgunthorpe
authored andcommitted
RDMA/bnxt_re: Fix an error path in bnxt_re_add_device
In bnxt_re_add_device(), when register netdev notifier fails, driver is not unregistering the IB device in the error cleanup path. Also, removed the duplicate cleanup in error path of bnxt_re_probe. Fixes: 94a9dc6 ("RDMA/bnxt_re: Group all operations under add_device and remove_device") Link: https://patch.msgid.link/r/[email protected] Signed-off-by: Kalesh AP <[email protected]> Signed-off-by: Selvin Xavier <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent 8be3e5b commit a5e099e

File tree

1 file changed

+3
-9
lines changed
  • drivers/infiniband/hw/bnxt_re

1 file changed

+3
-9
lines changed

drivers/infiniband/hw/bnxt_re/main.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1880,12 +1880,14 @@ static int bnxt_re_add_device(struct auxiliary_device *adev, u8 op_type)
18801880
rdev->nb.notifier_call = NULL;
18811881
pr_err("%s: Cannot register to netdevice_notifier",
18821882
ROCE_DRV_MODULE_NAME);
1883-
return rc;
1883+
goto re_dev_unreg;
18841884
}
18851885
bnxt_re_setup_cc(rdev, true);
18861886

18871887
return 0;
18881888

1889+
re_dev_unreg:
1890+
ib_unregister_device(&rdev->ibdev);
18891891
re_dev_uninit:
18901892
bnxt_re_update_en_info_rdev(NULL, en_info, adev);
18911893
bnxt_re_dev_uninit(rdev, BNXT_RE_COMPLETE_REMOVE);
@@ -2029,15 +2031,7 @@ static int bnxt_re_probe(struct auxiliary_device *adev,
20292031
auxiliary_set_drvdata(adev, en_info);
20302032

20312033
rc = bnxt_re_add_device(adev, BNXT_RE_COMPLETE_INIT);
2032-
if (rc)
2033-
goto err;
20342034
mutex_unlock(&bnxt_re_mutex);
2035-
return 0;
2036-
2037-
err:
2038-
mutex_unlock(&bnxt_re_mutex);
2039-
bnxt_re_remove(adev);
2040-
20412035
return rc;
20422036
}
20432037

0 commit comments

Comments
 (0)