All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] RDMA/cxgb4: remove redundant null pointer check before kfree_skb
@ 2018-09-20  9:52 ` zhong jiang
  0 siblings, 0 replies; 4+ messages in thread
From: zhong jiang @ 2018-09-20  9:52 UTC (permalink / raw)
  To: swise, dledford, jgg; +Cc: linux-rdma, linux-kernel

kfree_skb has taken the null pointer into account. hence it is safe
to remove the redundant null pointer check before kfree_skb.

Signed-off-by: zhong jiang <zhongjiang@huawei.com>
---
 drivers/infiniband/hw/cxgb4/cm.c | 3 +--
 drivers/infiniband/hw/cxgb4/qp.c | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c
index 0f83cbe..615413b 100644
--- a/drivers/infiniband/hw/cxgb4/cm.c
+++ b/drivers/infiniband/hw/cxgb4/cm.c
@@ -403,8 +403,7 @@ void _c4iw_free_ep(struct kref *kref)
 				 ep->com.local_addr.ss_family);
 		dst_release(ep->dst);
 		cxgb4_l2t_release(ep->l2t);
-		if (ep->mpa_skb)
-			kfree_skb(ep->mpa_skb);
+		kfree_skb(ep->mpa_skb);
 	}
 	if (!skb_queue_empty(&ep->com.ep_skb_list))
 		skb_queue_purge(&ep->com.ep_skb_list);
diff --git a/drivers/infiniband/hw/cxgb4/qp.c b/drivers/infiniband/hw/cxgb4/qp.c
index 347fe18..e78dd9a 100644
--- a/drivers/infiniband/hw/cxgb4/qp.c
+++ b/drivers/infiniband/hw/cxgb4/qp.c
@@ -2813,8 +2813,7 @@ struct ib_srq *c4iw_create_srq(struct ib_pd *pd, struct ib_srq_init_attr *attrs,
 	free_srq_queue(srq, ucontext ? &ucontext->uctx : &rhp->rdev.uctx,
 		       srq->wr_waitp);
 err_free_skb:
-	if (srq->destroy_skb)
-		kfree_skb(srq->destroy_skb);
+	kfree_skb(srq->destroy_skb);
 err_free_srq_idx:
 	c4iw_free_srq_idx(&rhp->rdev, srq->idx);
 err_free_wr_wait:
-- 
1.7.12.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] RDMA/cxgb4: remove redundant null pointer check before kfree_skb
@ 2018-09-20  9:52 ` zhong jiang
  0 siblings, 0 replies; 4+ messages in thread
From: zhong jiang @ 2018-09-20  9:52 UTC (permalink / raw)
  To: swise, dledford, jgg; +Cc: linux-rdma, linux-kernel

kfree_skb has taken the null pointer into account. hence it is safe
to remove the redundant null pointer check before kfree_skb.

Signed-off-by: zhong jiang <zhongjiang@huawei.com>
---
 drivers/infiniband/hw/cxgb4/cm.c | 3 +--
 drivers/infiniband/hw/cxgb4/qp.c | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c
index 0f83cbe..615413b 100644
--- a/drivers/infiniband/hw/cxgb4/cm.c
+++ b/drivers/infiniband/hw/cxgb4/cm.c
@@ -403,8 +403,7 @@ void _c4iw_free_ep(struct kref *kref)
 				 ep->com.local_addr.ss_family);
 		dst_release(ep->dst);
 		cxgb4_l2t_release(ep->l2t);
-		if (ep->mpa_skb)
-			kfree_skb(ep->mpa_skb);
+		kfree_skb(ep->mpa_skb);
 	}
 	if (!skb_queue_empty(&ep->com.ep_skb_list))
 		skb_queue_purge(&ep->com.ep_skb_list);
diff --git a/drivers/infiniband/hw/cxgb4/qp.c b/drivers/infiniband/hw/cxgb4/qp.c
index 347fe18..e78dd9a 100644
--- a/drivers/infiniband/hw/cxgb4/qp.c
+++ b/drivers/infiniband/hw/cxgb4/qp.c
@@ -2813,8 +2813,7 @@ struct ib_srq *c4iw_create_srq(struct ib_pd *pd, struct ib_srq_init_attr *attrs,
 	free_srq_queue(srq, ucontext ? &ucontext->uctx : &rhp->rdev.uctx,
 		       srq->wr_waitp);
 err_free_skb:
-	if (srq->destroy_skb)
-		kfree_skb(srq->destroy_skb);
+	kfree_skb(srq->destroy_skb);
 err_free_srq_idx:
 	c4iw_free_srq_idx(&rhp->rdev, srq->idx);
 err_free_wr_wait:
-- 
1.7.12.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] RDMA/cxgb4: remove redundant null pointer check before kfree_skb
  2018-09-20  9:52 ` zhong jiang
  (?)
@ 2018-09-20 14:26 ` Steve Wise
  -1 siblings, 0 replies; 4+ messages in thread
From: Steve Wise @ 2018-09-20 14:26 UTC (permalink / raw)
  To: zhong jiang, swise, dledford, jgg; +Cc: linux-rdma, linux-kernel



On 9/20/2018 4:52 AM, zhong jiang wrote:
> kfree_skb has taken the null pointer into account. hence it is safe
> to remove the redundant null pointer check before kfree_skb.
> 
> Signed-off-by: zhong jiang <zhongjiang@huawei.com>
> ---
>  drivers/infiniband/hw/cxgb4/cm.c | 3 +--
>  drivers/infiniband/hw/cxgb4/qp.c | 3 +--
>  2 files changed, 2 insertions(+), 4 deletions(-)

Acked-by: Steve Wise <swise@opengridcomputing.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] RDMA/cxgb4: remove redundant null pointer check before kfree_skb
  2018-09-20  9:52 ` zhong jiang
  (?)
  (?)
@ 2018-09-21 16:03 ` Doug Ledford
  -1 siblings, 0 replies; 4+ messages in thread
From: Doug Ledford @ 2018-09-21 16:03 UTC (permalink / raw)
  To: zhong jiang, swise, jgg; +Cc: linux-rdma, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 430 bytes --]

On Thu, 2018-09-20 at 17:52 +0800, zhong jiang wrote:
> kfree_skb has taken the null pointer into account. hence it is safe
> to remove the redundant null pointer check before kfree_skb.
> 
> Signed-off-by: zhong jiang <zhongjiang@huawei.com>

Applied to for-next, thanks.

-- 
Doug Ledford <dledford@redhat.com>
    GPG KeyID: B826A3330E572FDD
    Key fingerprint = AE6B 1BDA 122B 23B4 265B  1274 B826 A333 0E57 2FDD

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-09-21 16:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-20  9:52 [PATCH] RDMA/cxgb4: remove redundant null pointer check before kfree_skb zhong jiang
2018-09-20  9:52 ` zhong jiang
2018-09-20 14:26 ` Steve Wise
2018-09-21 16:03 ` Doug Ledford

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.