On Fri, Oct 28, 2022 at 03:50:53PM +0800, Haoyue Xu wrote: > From: Yunsheng Lin <linyunsheng@xxxxxxxxxx> > > 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@xxxxxxxxxx> > Signed-off-by: Haoyue Xu <xuhaoyue1@xxxxxxxxxxxxx> > --- > 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