From: Bart Van Assche <bart.vanassche@wdc.com>
Date: Fri, 6 Jul 2018 09:45:32 -0700
Subject: RDMA/rxe: Simplify the error handling code in rxe_create_ah()
Patch-mainline: v4.19-rc1
Git-commit: 2f229bcf25ca076e8d8f46b9b3dccad5751040d2
References: bsc#1103992 FATE#326009
This patch not only simplifies the error handling code in rxe_create_ah()
but also removes the dead code that was left behind by commit 47ec38666210
("RDMA: Convert drivers to use sgid_attr instead of sgid_index").
Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Reviewed-by: Parav Pandit <parav@mellanox.com>
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
---
drivers/infiniband/sw/rxe/rxe_verbs.c | 13 +++----------
1 file changed, 3 insertions(+), 10 deletions(-)
--- a/drivers/infiniband/sw/rxe/rxe_verbs.c
+++ b/drivers/infiniband/sw/rxe/rxe_verbs.c
@@ -241,24 +241,17 @@ static struct ib_ah *rxe_create_ah(struc
err = rxe_av_chk_attr(rxe, attr);
if (err)
- goto err1;
+ return ERR_PTR(err);
ah = rxe_alloc(&rxe->ah_pool);
- if (!ah) {
- err = -ENOMEM;
- goto err1;
- }
+ if (!ah)
+ return ERR_PTR(-ENOMEM);
rxe_add_ref(pd);
ah->pd = pd;
rxe_init_av(rxe, attr, &ah->av);
return &ah->ibah;
-
- rxe_drop_ref(pd);
- rxe_drop_ref(ah);
-err1:
- return ERR_PTR(err);
}
static int rxe_modify_ah(struct ib_ah *ibah, struct rdma_ah_attr *attr)