[PATCH] RDMA/cm: fix cond_no_effect.cocci warnings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxx>
Signed-off-by: Jiapeng Chong <jiapeng.chong@xxxxxxxxxxxxxxxxx>
---
 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




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux