RDMA/bnxt_re: Fix the ib_reg failure cleanup
authorSelvin Xavier <selvin.xavier@broadcom.com>
Mon, 26 Feb 2018 09:51:39 +0000 (01:51 -0800)
committerJason Gunthorpe <jgg@mellanox.com>
Wed, 28 Feb 2018 19:10:33 +0000 (12:10 -0700)
Release the netdev references in the cleanup path.  Invokes the cleanup
routines if bnxt_re_ib_reg fails.

Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/hw/bnxt_re/main.c

index 33a448036c2ebd99217a40b9bb9d6372a798af0d..604c805ceaa7af7b4cb9dadced2b38c2543ef60f 100644 (file)
@@ -1416,9 +1416,12 @@ static void bnxt_re_task(struct work_struct *work)
        switch (re_work->event) {
        case NETDEV_REGISTER:
                rc = bnxt_re_ib_reg(rdev);
-               if (rc)
+               if (rc) {
                        dev_err(rdev_to_dev(rdev),
                                "Failed to register with IB: %#x", rc);
+                       bnxt_re_remove_one(rdev);
+                       bnxt_re_dev_unreg(rdev);
+               }
                break;
        case NETDEV_UP:
                bnxt_re_dispatch_event(&rdev->ibdev, NULL, 1,