Skip to content

Commit

Permalink
RDMA/rxe: Return void from rxe_mem_init_dma()
Browse files Browse the repository at this point in the history
The return value from rxe_mem_init_dma() is always 0 - change it to be
void and fix the callers accordingly.

Fixes: 8700e3e ("Soft RoCE driver")
Link: https://lore.kernel.org/r/20200705104313.283034-4-kamalheib1@gmail.com
Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
  • Loading branch information
Kamal Heib authored and Jason Gunthorpe committed Jul 16, 2020
1 parent 9d576ea commit 293d844
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 23 deletions.
4 changes: 2 additions & 2 deletions drivers/infiniband/sw/rxe/rxe_loc.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ enum copy_direction {
from_mem_obj,
};

int rxe_mem_init_dma(struct rxe_pd *pd,
int access, struct rxe_mem *mem);
void rxe_mem_init_dma(struct rxe_pd *pd,
int access, struct rxe_mem *mem);

int rxe_mem_init_user(struct rxe_pd *pd, u64 start,
u64 length, u64 iova, int access, struct ib_udata *udata,
Expand Down
6 changes: 2 additions & 4 deletions drivers/infiniband/sw/rxe/rxe_mr.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,17 +144,15 @@ static int rxe_mem_alloc(struct rxe_mem *mem, int num_buf)
return -ENOMEM;
}

int rxe_mem_init_dma(struct rxe_pd *pd,
int access, struct rxe_mem *mem)
void rxe_mem_init_dma(struct rxe_pd *pd,
int access, struct rxe_mem *mem)
{
rxe_mem_init(access, mem);

mem->pd = pd;
mem->access = access;
mem->state = RXE_MEM_STATE_VALID;
mem->type = RXE_MEM_TYPE_DMA;

return 0;
}

int rxe_mem_init_user(struct rxe_pd *pd, u64 start,
Expand Down
20 changes: 3 additions & 17 deletions drivers/infiniband/sw/rxe/rxe_verbs.c
Original file line number Diff line number Diff line change
Expand Up @@ -901,30 +901,16 @@ static struct ib_mr *rxe_get_dma_mr(struct ib_pd *ibpd, int access)
struct rxe_dev *rxe = to_rdev(ibpd->device);
struct rxe_pd *pd = to_rpd(ibpd);
struct rxe_mem *mr;
int err;

mr = rxe_alloc(&rxe->mr_pool);
if (!mr) {
err = -ENOMEM;
goto err1;
}
if (!mr)
return ERR_PTR(-ENOMEM);

rxe_add_index(mr);

rxe_add_ref(pd);

err = rxe_mem_init_dma(pd, access, mr);
if (err)
goto err2;
rxe_mem_init_dma(pd, access, mr);

return &mr->ibmr;

err2:
rxe_drop_ref(pd);
rxe_drop_index(mr);
rxe_drop_ref(mr);
err1:
return ERR_PTR(err);
}

static struct ib_mr *rxe_reg_user_mr(struct ib_pd *ibpd,
Expand Down

0 comments on commit 293d844

Please sign in to comment.