RDMA/cxgb3: Clean up signed check of unsigned variable
authorDan Carpenter <error27@gmail.com>
Mon, 19 Jul 2010 20:30:14 +0000 (20:30 +0000)
committerRoland Dreier <rolandd@cisco.com>
Wed, 21 Jul 2010 17:57:25 +0000 (10:57 -0700)
Q_FREECNT() returns the number of spaces free.  This should never be a
negative amount.  Also the num_wrs is an unsigned int so it can never
be less than zero.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Acked-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
drivers/infiniband/hw/cxgb3/iwch_qp.c

index ae47bfd22bd525eb4d4ff2b317790a3b408cc635..6adc13fc1e4c5ff7e841288ff5c06c4c379e5e40 100644 (file)
@@ -371,7 +371,7 @@ int iwch_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
        }
        num_wrs = Q_FREECNT(qhp->wq.sq_rptr, qhp->wq.sq_wptr,
                  qhp->wq.sq_size_log2);
-       if (num_wrs <= 0) {
+       if (num_wrs == 0) {
                spin_unlock_irqrestore(&qhp->lock, flag);
                err = -ENOMEM;
                goto out;
@@ -554,7 +554,7 @@ int iwch_bind_mw(struct ib_qp *qp,
        }
        num_wrs = Q_FREECNT(qhp->wq.sq_rptr, qhp->wq.sq_wptr,
                            qhp->wq.sq_size_log2);
-       if ((num_wrs) <= 0) {
+       if (num_wrs == 0) {
                spin_unlock_irqrestore(&qhp->lock, flag);
                return -ENOMEM;
        }