Skip to contentSkip to conversation

ib_srpt: Simplify __srpt_lookup_port()

PATCH In review Bart Van Assche 1 participant 1 message Nov 11, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 3/3 ib_srpt: Simplify __srpt_lookup_port()

The sdev->device pointer is initialized in srpt_add_one() and is not modified until the sdev structure is freed in srpt_remove_one(). An sdev structure is only added to srpt_dev_list after the device pointer has been initialized and is removed from that list before srpt_remove_one() returns. Calls to __srpt_lookup_port() are protected via the same spinlock that protects srpt_dev_list. Hence the sdev->device pointer is never NULL nor invalid inside __srpt_lookup_port(). That means that it is safe to remove the sdev->device test in that function.

Cc Nicholas Bellinger <[email protected]>
Cc Roland Dreier <[email protected]>
Cc Christoph Hellwig <[email protected]>
---
 drivers/infiniband/ulp/srpt/ib_srpt.c |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)
drivers/infiniband/ulp/srpt/ib_srpt.c +0 -3
index b93e1a0..2b7d6fb 100644
@@ -3144,9 +3144,6 @@ static struct srpt_port *__srpt_lookup_port(const char *name)
 
 	list_for_each_entry(sdev, &srpt_dev_list, list) {
 		dev = sdev->device;
-		if (!dev)
-			continue;
-
 		for (i = 0; i < dev->phys_port_cnt; i++) {
 			sport = &sdev->port[i];
 
Signature · 6 lines
1.7.3.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html