Skip to contentSkip to conversation

IB/qib: correction for faulty sparse warning correction

PATCH New Mike Marciniszyn 1 participant 1 message Jan 24, 2013 InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 IB/qib: correction for faulty sparse warning correction

Commit 1fb9fed ("IB/qib: Fix QP RCU sparse warning") broke qp hash list deletion in qp_remove() badly.

This patch restores the former for loop behavior, while still fixing the sparse warnings.

---
 drivers/infiniband/hw/qib/qib_qp.c |   11 +++--------
 1 files changed, 3 insertions(+), 8 deletions(-)
drivers/infiniband/hw/qib/qib_qp.c +3 -8
index 4850d03..3527509 100644
@@ -263,20 +263,15 @@ static void remove_qp(struct qib_ibdev *dev, struct qib_qp *qp)
 		struct qib_qp __rcu **qpp;
 
 		qpp = &dev->qp_table[n];
-		q = rcu_dereference_protected(*qpp,
-			lockdep_is_held(&dev->qpt_lock));
-		for (; q; qpp = &q->next) {
+		for (; (q = rcu_dereference_protected(*qpp,
+				lockdep_is_held(&dev->qpt_lock))) != NULL;
+				qpp = &q->next)
 			if (q == qp) {
 				atomic_dec(&qp->refcount);
 				*qpp = qp->next;
 				rcu_assign_pointer(qp->next, NULL);
-				q = rcu_dereference_protected(*qpp,
-					lockdep_is_held(&dev->qpt_lock));
 				break;
 			}
-			q = rcu_dereference_protected(*qpp,
-				lockdep_is_held(&dev->qpt_lock));
-		}
 	}
 
 	spin_unlock_irqrestore(&dev->qpt_lock, flags);

--
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