[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1620291106-3675-1-git-send-email-tanxiaofei@huawei.com>
Date: Thu, 6 May 2021 16:51:46 +0800
From: Xiaofei Tan <tanxiaofei@...wei.com>
To: <jgg@...pe.ca>, <leon@...nel.org>
CC: <liweihang@...wei.com>, <liangwenpeng@...wei.com>,
<shiju.jose@...wei.com>, <linux-rdma@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <linuxarm@...neuler.org>,
Xiaofei Tan <tanxiaofei@...wei.com>
Subject: [PATCH] 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.
Signed-off-by: Xiaofei Tan <tanxiaofei@...wei.com>
---
drivers/infiniband/core/ucma.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
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);
--
2.8.1
Powered by blists - more mailing lists