linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] RDMA/cm: fix cond_no_effect.cocci warnings
@ 2022-06-10  9:45 Jiapeng Chong
  2022-06-14  1:19 ` Mark Zhang
  0 siblings, 1 reply; 5+ messages in thread
From: Jiapeng Chong @ 2022-06-10  9:45 UTC (permalink / raw)
  To: jgg; +Cc: leon, linux-rdma, linux-kernel, Jiapeng Chong, Abaci Robot

This was found by coccicheck:

./drivers/infiniband/core/cm.c:685:7-9: WARNING: possible condition with no effect (if == else).

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
 drivers/infiniband/core/cm.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c
index 1c107d6d03b9..bb6a2b6b9657 100644
--- a/drivers/infiniband/core/cm.c
+++ b/drivers/infiniband/core/cm.c
@@ -676,14 +676,9 @@ static struct cm_id_private *cm_find_listen(struct ib_device *device,
 			refcount_inc(&cm_id_priv->refcount);
 			return cm_id_priv;
 		}
-		if (device < cm_id_priv->id.device)
+		if (device < cm_id_priv->id.device ||
+		    be64_lt(service_id, cm_id_priv->id.service_id))
 			node = node->rb_left;
-		else if (device > cm_id_priv->id.device)
-			node = node->rb_right;
-		else if (be64_lt(service_id, cm_id_priv->id.service_id))
-			node = node->rb_left;
-		else if (be64_gt(service_id, cm_id_priv->id.service_id))
-			node = node->rb_right;
 		else
 			node = node->rb_right;
 	}
-- 
2.20.1.7.g153144c


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

end of thread, other threads:[~2022-08-02 13:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-10  9:45 [PATCH] RDMA/cm: fix cond_no_effect.cocci warnings Jiapeng Chong
2022-06-14  1:19 ` Mark Zhang
2022-06-24 20:17   ` Jason Gunthorpe
2022-08-02  2:15     ` Mark Zhang
2022-08-02 13:52       ` Jason Gunthorpe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).