Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1710407

[PATCH] IB/core: fix duplicated code for different branches

From "Gustavo A. R. Silva" <gustavo@embeddedor.com>
Newsgroups linux.kernel
Subject [PATCH] IB/core: fix duplicated code for different branches
Date 2017-08-13 03:00 +0200
Message-ID <udPq2-8h4-7@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


Refactor code to avoid identical code for different branches.

This issue was detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
 drivers/infiniband/core/cm.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c
index 2b4d613..b46262f 100644
--- a/drivers/infiniband/core/cm.c
+++ b/drivers/infiniband/core/cm.c
@@ -590,8 +590,6 @@ static struct cm_id_private * cm_insert_listen(struct cm_id_private *cm_id_priv)
 			link = &(*link)->rb_right;
 		else if (be64_lt(service_id, cur_cm_id_priv->id.service_id))
 			link = &(*link)->rb_left;
-		else if (be64_gt(service_id, cur_cm_id_priv->id.service_id))
-			link = &(*link)->rb_right;
 		else
 			link = &(*link)->rb_right;
 	}
@@ -619,8 +617,6 @@ static struct cm_id_private * cm_find_listen(struct ib_device *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.5.0

Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

[PATCH] IB/core: fix duplicated code for different branches "Gustavo A. R. Silva" <gustavo@embeddedor.com> - 2017-08-13 03:00 +0200
  Re: [PATCH] IB/core: fix duplicated code for different branches Leon Romanovsky <leon@kernel.org> - 2017-08-13 08:40 +0200
    Re: [PATCH] IB/core: fix duplicated code for different branches "Gustavo A. R. Silva" <gustavo@embeddedor.com> - 2017-08-18 02:00 +0200

csiph-web