Skip to content

Commit

Permalink
RDMA/erdma: Fix error code in erdma_create_scatter_mtt()
Browse files Browse the repository at this point in the history
The erdma_create_scatter_mtt() function is supposed to return error
pointers.  Returning NULL will lead to an Oops.

Fixes: ed10435 ("RDMA/erdma: Implement hierarchical MTT")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://lore.kernel.org/r/1eb400d5-d8a3-4a8e-b3da-c43c6c377f86@moroto.mountain
Acked-by: Cheng Xu <chengyou@linux.alibaba.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
  • Loading branch information
Dan Carpenter authored and Leon Romanovsky committed Sep 18, 2023
1 parent c489800 commit 6b5f074
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/infiniband/hw/erdma/erdma_verbs.c
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ static struct erdma_mtt *erdma_create_scatter_mtt(struct erdma_dev *dev,

mtt = kzalloc(sizeof(*mtt), GFP_KERNEL);
if (!mtt)
return NULL;
return ERR_PTR(-ENOMEM);

mtt->size = ALIGN(size, PAGE_SIZE);
mtt->buf = vzalloc(mtt->size);
Expand Down

0 comments on commit 6b5f074

Please sign in to comment.