Skip to content

Commit d359f35

Browse files
mmarcinirolandd
authored andcommitted
IB/qib: Fix for broken sparse warning fix
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. Cc: <stable@vger.kernel.org> Reviewed-by: Gary Leshner <gary.s.leshner@intel.com> Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com> Signed-off-by: Roland Dreier <roland@purestorage.com>
1 parent 949db15 commit d359f35

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

drivers/infiniband/hw/qib/qib_qp.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -263,20 +263,15 @@ static void remove_qp(struct qib_ibdev *dev, struct qib_qp *qp)
263263
struct qib_qp __rcu **qpp;
264264

265265
qpp = &dev->qp_table[n];
266-
q = rcu_dereference_protected(*qpp,
267-
lockdep_is_held(&dev->qpt_lock));
268-
for (; q; qpp = &q->next) {
266+
for (; (q = rcu_dereference_protected(*qpp,
267+
lockdep_is_held(&dev->qpt_lock))) != NULL;
268+
qpp = &q->next)
269269
if (q == qp) {
270270
atomic_dec(&qp->refcount);
271271
*qpp = qp->next;
272272
rcu_assign_pointer(qp->next, NULL);
273-
q = rcu_dereference_protected(*qpp,
274-
lockdep_is_held(&dev->qpt_lock));
275273
break;
276274
}
277-
q = rcu_dereference_protected(*qpp,
278-
lockdep_is_held(&dev->qpt_lock));
279-
}
280275
}
281276

282277
spin_unlock_irqrestore(&dev->qpt_lock, flags);

0 commit comments

Comments
 (0)