From: Xiaofei Tan Date: Thu, 6 May 2021 08:51:46 +0000 (+0800) Subject: RDMA/ucma: Cleanup to reduce duplicate code X-Git-Tag: accepted/tizen/unified/20230118.172025~6935^2~194 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e3d65124ce2bf43f2d65f925e590482bd676f2f4;p=platform%2Fkernel%2Flinux-rpi.git RDMA/ucma: Cleanup to reduce duplicate code The lable "err1" does the same thing as the branch of copy_to_user() failed in the function ucma_create_id(). Just jump to the label directly to reduce duplicate code. Link: https://lore.kernel.org/r/1620291106-3675-1-git-send-email-tanxiaofei@huawei.com Signed-off-by: Xiaofei Tan Reviewed-by: Leon Romanovsky Signed-off-by: Jason Gunthorpe --- diff --git a/drivers/infiniband/core/ucma.c b/drivers/infiniband/core/ucma.c index 15d57ba..1f198c1 100644 --- a/drivers/infiniband/core/ucma.c +++ b/drivers/infiniband/core/ucma.c @@ -468,8 +468,8 @@ static ssize_t ucma_create_id(struct ucma_file *file, const char __user *inbuf, resp.id = ctx->id; if (copy_to_user(u64_to_user_ptr(cmd.response), &resp, sizeof(resp))) { - ucma_destroy_private_ctx(ctx); - return -EFAULT; + ret = -EFAULT; + goto err1; } mutex_lock(&file->mut);