From: Xiaofei Tan <tanxiaofei@huawei.com>
To: <jgg@ziepe.ca>, <leon@kernel.org>
Cc: <liweihang@huawei.com>, <liangwenpeng@huawei.com>,
<shiju.jose@huawei.com>, <linux-rdma@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <linuxarm@openeuler.org>,
Xiaofei Tan <tanxiaofei@huawei.com>
Subject: [PATCH] RDMA/ucma: Cleanup to reduce duplicate code
Date: Thu, 6 May 2021 16:51:46 +0800 [thread overview]
Message-ID: <1620291106-3675-1-git-send-email-tanxiaofei@huawei.com> (raw)
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@huawei.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
next reply other threads:[~2021-05-06 8:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-06 8:51 Xiaofei Tan [this message]
2021-05-06 9:04 ` [PATCH] RDMA/ucma: Cleanup to reduce duplicate code Leon Romanovsky
2021-05-11 19:37 ` Jason Gunthorpe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1620291106-3675-1-git-send-email-tanxiaofei@huawei.com \
--to=tanxiaofei@huawei.com \
--cc=jgg@ziepe.ca \
--cc=leon@kernel.org \
--cc=liangwenpeng@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=linuxarm@openeuler.org \
--cc=liweihang@huawei.com \
--cc=shiju.jose@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox