All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: Haoyue Xu <xuhaoyue1@hisilicon.com>
Cc: leon@kernel.org, zyjzyj2000@gmail.com,
	linux-rdma@vger.kernel.org, linuxarm@huawei.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 for-next] RDMA/rxe: cleanup some error handling in rxe_verbs.c
Date: Fri, 28 Oct 2022 15:17:33 -0300	[thread overview]
Message-ID: <Y1wcvS0ZI3acUGcF@nvidia.com> (raw)
In-Reply-To: <20221028075053.3990467-1-xuhaoyue1@hisilicon.com>

On Fri, Oct 28, 2022 at 03:50:53PM +0800, Haoyue Xu wrote:
> From: Yunsheng Lin <linyunsheng@huawei.com>
> 
> Instead of 'goto and return', just return directly to
> simplify the error handling, and avoid some unnecessary
> return value check.
> 
> Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
> Signed-off-by: Haoyue Xu <xuhaoyue1@hisilicon.com>
> ---
> Changes since v1:
> 	Rebased to fix some conflict in the patch.
> 
>  drivers/infiniband/sw/rxe/rxe_verbs.c | 80 ++++++++-------------------
>  1 file changed, 23 insertions(+), 57 deletions(-)

This is good, applied to for-next, thanks

> @@ -921,26 +894,22 @@ static struct ib_mr *rxe_reg_user_mr(struct ib_pd *ibpd,
>  	struct rxe_mr *mr;
>  
>  	mr = rxe_alloc(&rxe->mr_pool);
> -	if (!mr) {
> -		err = -ENOMEM;
> -		goto err2;
> -	}
> -
> +	if (!mr)
> +		return ERR_PTR(-ENOMEM);
>  
>  	rxe_get(pd);
>  	mr->ibmr.pd = ibpd;
>  
>  	err = rxe_mr_init_user(rxe, start, length, iova, access, mr);
>  	if (err)
> -		goto err3;
> +		goto err1;
>  
>  	rxe_finalize(mr);
>  
>  	return &mr->ibmr;
>  
> -err3:
> +err1:
>  	rxe_cleanup(mr);
> -err2:
>  	return ERR_PTR(err);
>  }
>  
> @@ -956,25 +925,22 @@ static struct ib_mr *rxe_alloc_mr(struct ib_pd *ibpd, enum ib_mr_type mr_type,
>  		return ERR_PTR(-EINVAL);
>  
>  	mr = rxe_alloc(&rxe->mr_pool);
> -	if (!mr) {
> -		err = -ENOMEM;
> -		goto err1;
> -	}
> +	if (!mr)
> +		return ERR_PTR(-ENOMEM);
>  
>  	rxe_get(pd);
>  	mr->ibmr.pd = ibpd;
>  
>  	err = rxe_mr_init_fast(max_num_sg, mr);
>  	if (err)
> -		goto err2;
> +		goto err1;
>  
>  	rxe_finalize(mr);
>  
>  	return &mr->ibmr;
>  
> -err2:
> -	rxe_cleanup(mr);
>  err1:
> +	rxe_cleanup(mr);
>  	return ERR_PTR(err);
>  }
>  

I fixed these two err1 labels though, do not use the errN format. I
changed them both to err_cleanup

Thanks,
Jason

      reply	other threads:[~2022-10-28 18:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-28  7:50 [PATCH v2 for-next] RDMA/rxe: cleanup some error handling in rxe_verbs.c Haoyue Xu
2022-10-28 18:17 ` Jason Gunthorpe [this message]

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=Y1wcvS0ZI3acUGcF@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=xuhaoyue1@hisilicon.com \
    --cc=zyjzyj2000@gmail.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 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.