diff mbox series

RDMA/core: Cosmetic change - move member initialization to correct block

Message ID 20190218091919.6176-1-yuval.shaia@oracle.com (mailing list archive)
State Superseded
Headers show
Series RDMA/core: Cosmetic change - move member initialization to correct block | expand

Commit Message

Yuval Shaia Feb. 18, 2019, 9:19 a.m. UTC
old_pd is used only if IB_MR_REREG_PD flags is set.
For readability move it's initialization to where it is used.

Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com>
---
 drivers/infiniband/core/uverbs_cmd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Leon Romanovsky Feb. 18, 2019, 10:46 a.m. UTC | #1
On Mon, Feb 18, 2019 at 11:19:19AM +0200, Yuval Shaia wrote:
> old_pd is used only if IB_MR_REREG_PD flags is set.
> For readability move it's initialization to where it is used.
>
> Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com>
> ---
>  drivers/infiniband/core/uverbs_cmd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
> index d4f1a2ef5015..8d749bdcbdcd 100644
> --- a/drivers/infiniband/core/uverbs_cmd.c
> +++ b/drivers/infiniband/core/uverbs_cmd.c
> @@ -810,12 +810,12 @@ static int ib_uverbs_rereg_mr(struct uverbs_attr_bundle *attrs)
>  		}
>  	}
>
> -	old_pd = mr->pd;
>  	ret = mr->device->ops.rereg_user_mr(mr, cmd.flags, cmd.start,
>  					    cmd.length, cmd.hca_va,
>  					    cmd.access_flags, pd,
>  					    &attrs->driver_udata);
>  	if (!ret) {
> +		old_pd = mr->pd;
>  		if (cmd.flags & IB_MR_REREG_PD) {
>  			atomic_inc(&pd->usecnt);
>  			mr->pd = pd;

Can you you please rewrite the whole if(!ret) .. else construction?

if (ret)
  goto put_uobj_pd

if (cmd.flags & IB_MR_REREG_PD) {
   struct ib_pd *old_pd = mr->pd;
   ......
}

Thanks


> --
> 2.20.1
>
diff mbox series

Patch

diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
index d4f1a2ef5015..8d749bdcbdcd 100644
--- a/drivers/infiniband/core/uverbs_cmd.c
+++ b/drivers/infiniband/core/uverbs_cmd.c
@@ -810,12 +810,12 @@  static int ib_uverbs_rereg_mr(struct uverbs_attr_bundle *attrs)
 		}
 	}
 
-	old_pd = mr->pd;
 	ret = mr->device->ops.rereg_user_mr(mr, cmd.flags, cmd.start,
 					    cmd.length, cmd.hca_va,
 					    cmd.access_flags, pd,
 					    &attrs->driver_udata);
 	if (!ret) {
+		old_pd = mr->pd;
 		if (cmd.flags & IB_MR_REREG_PD) {
 			atomic_inc(&pd->usecnt);
 			mr->pd = pd;