All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] RDMA/ucma: Cleanup to reduce duplicate code
@ 2021-05-06  8:51 Xiaofei Tan
  2021-05-06  9:04 ` Leon Romanovsky
  2021-05-11 19:37 ` Jason Gunthorpe
  0 siblings, 2 replies; 3+ messages in thread
From: Xiaofei Tan @ 2021-05-06  8:51 UTC (permalink / raw)
  To: jgg, leon
  Cc: liweihang, liangwenpeng, shiju.jose, linux-rdma, linux-kernel,
	linuxarm, Xiaofei Tan

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] RDMA/ucma: Cleanup to reduce duplicate code
  2021-05-06  8:51 [PATCH] RDMA/ucma: Cleanup to reduce duplicate code Xiaofei Tan
@ 2021-05-06  9:04 ` Leon Romanovsky
  2021-05-11 19:37 ` Jason Gunthorpe
  1 sibling, 0 replies; 3+ messages in thread
From: Leon Romanovsky @ 2021-05-06  9:04 UTC (permalink / raw)
  To: Xiaofei Tan
  Cc: jgg, liweihang, liangwenpeng, shiju.jose, linux-rdma,
	linux-kernel, linuxarm

On Thu, May 06, 2021 at 04:51:46PM +0800, Xiaofei Tan wrote:
> 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(-)
> 

Thanks,
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] RDMA/ucma: Cleanup to reduce duplicate code
  2021-05-06  8:51 [PATCH] RDMA/ucma: Cleanup to reduce duplicate code Xiaofei Tan
  2021-05-06  9:04 ` Leon Romanovsky
@ 2021-05-11 19:37 ` Jason Gunthorpe
  1 sibling, 0 replies; 3+ messages in thread
From: Jason Gunthorpe @ 2021-05-11 19:37 UTC (permalink / raw)
  To: Xiaofei Tan
  Cc: leon, liweihang, liangwenpeng, shiju.jose, linux-rdma,
	linux-kernel, linuxarm

On Thu, May 06, 2021 at 04:51:46PM +0800, Xiaofei Tan wrote:
> 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>
> Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
> ---
>  drivers/infiniband/core/ucma.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Applied to for-next, thanks

Jason

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-05-11 19:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-06  8:51 [PATCH] RDMA/ucma: Cleanup to reduce duplicate code Xiaofei Tan
2021-05-06  9:04 ` Leon Romanovsky
2021-05-11 19:37 ` Jason Gunthorpe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.