RDMA/core: Remove unnecessary statements
PATCH 1/1 RDMA/core: Remove unnecessary statements
The rdma_zalloc_drv_obj() in __ib_alloc_pd() would zero pd, it unnecessary add NULL to the object in struct pd.
The uverbs_free_pd() already return busy if pd->usecnt is true, there is no need to add a warning.
--- drivers/infiniband/core/verbs.c | 7 ------- 1 file changed, 7 deletions(-)
drivers/infiniband/core/verbs.c +0 -7
@@ -268,8 +268,6 @@ struct ib_pd *__ib_alloc_pd(struct ib_device *device, unsigned int flags,return ERR_PTR (-ENOMEM ); pd->device = device; - pd->uobject =NULL ; - pd->__internal_mr =NULL ;atomic_set (&pd->usecnt,0 ); pd->flags = flags;
@@ -341,11 +339,6 @@ int ib_dealloc_pd_user(struct ib_pd *pd, struct ib_udata *udata) pd->__internal_mr =NULL ; } -/* uverbs manipulates usecnt with proper locking, while the kabi -* requires the caller to guarantee we can't race here. -*/ -WARN_ON (atomic_read (&pd->usecnt)); - ret = pd->device->ops.dealloc_pd (pd, udata);if (ret)return ret;
Signature · 1 line
2.25.1
Quoted 16 lines · Yajun Deng
The
rdma_zalloc_drv_obj()in__ib_alloc_pd()would zero pd, it unnecessary add NULL to the object in struct pd.The
uverbs_free_pd()already return busy ifpd->usecntis true, there is no need to add a warning.Signed-off-by Yajun Deng <[email protected]>--- drivers/infiniband/core/verbs.c | 7 ------- 1 file changed, 7 deletions(-)drivers/infiniband/core/verbs.c +0
-0
drivers/infiniband/core/verbs.c struct ib_pd *__ib_alloc_pd(struct ib_device *device, unsigned int flags, · line 271
Quoted 6 lines
drivers/infiniband/core/verbs.c +0
-2@@ -268,8 +268,6 @@ struct ib_pd *__ib_alloc_pd(struct ib_device *device, unsigned int flags,return ERR_PTR (-ENOMEM ); pd->device = device; - pd->uobject =NULL ; - pd->__internal_mr =NULL ;atomic_set (&pd->usecnt,0 );
^^^^^^^^ this line should be removed too.
drivers/infiniband/core/verbs.c int ib_dealloc_pd_user(struct ib_pd *pd, struct ib_udata *udata) · line 348
Quoted 11 lines
drivers/infiniband/core/verbs.c +0
-5pd->flags = flags;@@ -341,11 +339,6 @@ int ib_dealloc_pd_user(struct ib_pd *pd, struct ib_udata *udata) pd->__internal_mr =NULL ; } -/* uverbs manipulates usecnt with proper locking, while the kabi -* requires the caller to guarantee we can't race here. -*/ -WARN_ON (atomic_read (&pd->usecnt)); -
ib_dealloc_pd_user() is called not only in uverbs_free_pd(), but in ib_dealloc_pd() too. So commit message is not really correct.
Of course, ib_dealloc_pd() is kernel verb and doesn't use ->usecnt at all.
Thanks,
Quoted 10 lines · Yajun Deng
The
rdma_zalloc_drv_obj()in__ib_alloc_pd()would zero pd, it unnecessary add NULL to the object in struct pd.The
uverbs_free_pd()already return busy ifpd->usecntis true, there is no need to add a warning.Signed-off-by Yajun Deng <[email protected]>Reviewed-by Leon Romanovsky <[email protected]>drivers/infiniband/core/verbs.c | 7 ------- 1 file changed, 7 deletions(-)
Applied to for-next, with Leon's note added
Thanks,
Jason