diff mbox

[3/5] rds: ib: remove redundant ib_dealloc_fmr

Message ID 1489044405-26150-3-git-send-email-yanjun.zhu@oracle.com (mailing list archive)
State Not Applicable
Headers show

Commit Message

Zhu Yanjun March 9, 2017, 7:26 a.m. UTC
The function ib_dealloc_fmr will never be called. As such, it should
be removed.

Cc: Joe Jin <joe.jin@oracle.com>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Signed-off-by: Zhu Yanjun <yanjun.zhu@oracle.com>
---
 net/rds/ib_fmr.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Johannes Thumshirn March 9, 2017, 8:16 a.m. UTC | #1
On 03/09/2017 08:26 AM, Zhu Yanjun wrote:
> The function ib_dealloc_fmr will never be called. As such, it should
> be removed.
> 
> Cc: Joe Jin <joe.jin@oracle.com>
> Cc: Junxiao Bi <junxiao.bi@oracle.com>
> Signed-off-by: Zhu Yanjun <yanjun.zhu@oracle.com>
> ---
>  net/rds/ib_fmr.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/net/rds/ib_fmr.c b/net/rds/ib_fmr.c
> index 4fe8f4f..b807df6 100644
> --- a/net/rds/ib_fmr.c
> +++ b/net/rds/ib_fmr.c
> @@ -78,12 +78,10 @@ struct rds_ib_mr *rds_ib_alloc_fmr(struct rds_ib_device *rds_ibdev, int npages)
>  	return ibmr;
>  
>  out_no_cigar:
> -	if (ibmr) {
> -		if (fmr->fmr)
> -			ib_dealloc_fmr(fmr->fmr);
> +	if (ibmr)
>  		kfree(ibmr);

kfree() already does a NULL check (see
http://lxr.free-electrons.com/source/mm/slab.c#L3811) so no need to do
it here.
diff mbox

Patch

diff --git a/net/rds/ib_fmr.c b/net/rds/ib_fmr.c
index 4fe8f4f..b807df6 100644
--- a/net/rds/ib_fmr.c
+++ b/net/rds/ib_fmr.c
@@ -78,12 +78,10 @@  struct rds_ib_mr *rds_ib_alloc_fmr(struct rds_ib_device *rds_ibdev, int npages)
 	return ibmr;
 
 out_no_cigar:
-	if (ibmr) {
-		if (fmr->fmr)
-			ib_dealloc_fmr(fmr->fmr);
+	if (ibmr)
 		kfree(ibmr);
-	}
 	atomic_dec(&pool->item_count);
+
 	return ERR_PTR(err);
 }