Commit b6ba6855 authored by Leon Romanovsky's avatar Leon Romanovsky Committed by Leon Romanovsky

RDMA/rxe: Clean kzalloc failure paths

There is no need to print any debug messages after failure to
allocate memory, because kernel will print OOM dumps anyway.

Together with removal of these messages, remove useless goto jumps.

Fixes: 5bf944f2 ("RDMA/rxe: Add error messages")
Reported-by: default avatarDan Carpenter <error27@gmail.com>
Link: https://lore.kernel.org/all/ea43486f-43dd-4054-b1d5-3a0d202be621@kili.mountain
Link: https://lore.kernel.org/r/d3cedf723b84e73e8062a67b7489d33802bafba2.1680113597.git.leon@kernel.orgReviewed-by: default avatarBob Pearson <rpearsonhpe@gmail.com>
Signed-off-by: default avatarLeon Romanovsky <leonro@nvidia.com>
parent 78b26a33
......@@ -61,11 +61,11 @@ struct rxe_queue *rxe_queue_init(struct rxe_dev *rxe, int *num_elem,
/* num_elem == 0 is allowed, but uninteresting */
if (*num_elem < 0)
goto err1;
return NULL;
q = kzalloc(sizeof(*q), GFP_KERNEL);
if (!q)
goto err1;
return NULL;
q->rxe = rxe;
q->type = type;
......@@ -100,7 +100,6 @@ struct rxe_queue *rxe_queue_init(struct rxe_dev *rxe, int *num_elem,
err2:
kfree(q);
err1:
return NULL;
}
......
......@@ -1198,11 +1198,8 @@ static struct ib_mr *rxe_get_dma_mr(struct ib_pd *ibpd, int access)
int err;
mr = kzalloc(sizeof(*mr), GFP_KERNEL);
if (!mr) {
err = -ENOMEM;
rxe_dbg_dev(rxe, "no memory for mr");
goto err_out;
}
if (!mr)
return ERR_PTR(-ENOMEM);
err = rxe_add_to_pool(&rxe->mr_pool, mr);
if (err) {
......@@ -1220,7 +1217,6 @@ static struct ib_mr *rxe_get_dma_mr(struct ib_pd *ibpd, int access)
err_free:
kfree(mr);
err_out:
rxe_err_pd(pd, "returned err = %d", err);
return ERR_PTR(err);
}
......@@ -1235,11 +1231,8 @@ static struct ib_mr *rxe_reg_user_mr(struct ib_pd *ibpd, u64 start,
int err, cleanup_err;
mr = kzalloc(sizeof(*mr), GFP_KERNEL);
if (!mr) {
err = -ENOMEM;
rxe_dbg_pd(pd, "no memory for mr");
goto err_out;
}
if (!mr)
return ERR_PTR(-ENOMEM);
err = rxe_add_to_pool(&rxe->mr_pool, mr);
if (err) {
......@@ -1266,7 +1259,6 @@ static struct ib_mr *rxe_reg_user_mr(struct ib_pd *ibpd, u64 start,
rxe_err_mr(mr, "cleanup failed, err = %d", cleanup_err);
err_free:
kfree(mr);
err_out:
rxe_err_pd(pd, "returned err = %d", err);
return ERR_PTR(err);
}
......@@ -1287,17 +1279,12 @@ static struct ib_mr *rxe_alloc_mr(struct ib_pd *ibpd, enum ib_mr_type mr_type,
}
mr = kzalloc(sizeof(*mr), GFP_KERNEL);
if (!mr) {
err = -ENOMEM;
rxe_dbg_mr(mr, "no memory for mr");
goto err_out;
}
if (!mr)
return ERR_PTR(-ENOMEM);
err = rxe_add_to_pool(&rxe->mr_pool, mr);
if (err) {
rxe_dbg_mr(mr, "unable to create mr, err = %d", err);
if (err)
goto err_free;
}
rxe_get(pd);
mr->ibmr.pd = ibpd;
......
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