]> err.no Git - linux-2.6/commitdiff
IB/mthca: Make functions that never fail return void
authorRoland Dreier <rolandd@cisco.com>
Wed, 1 Feb 2006 04:45:51 +0000 (20:45 -0800)
committerRoland Dreier <rolandd@cisco.com>
Mon, 20 Mar 2006 18:08:07 +0000 (10:08 -0800)
The function mthca_free_err_wqe() can never fail, so get rid of its
return value.  That means handle_error_cqe() doesn't have to check
what mthca_free_err_wqe() returns, which means it can't fail either
and doesn't have to return anything either.  All this results in
simpler source code and a slight object code improvement:

add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-10 (-10)
function                                     old     new   delta
mthca_free_err_wqe                            83      81      -2
mthca_poll_cq                               1758    1750      -8

Signed-off-by: Roland Dreier <rolandd@cisco.com>
drivers/infiniband/hw/mthca/mthca_cq.c
drivers/infiniband/hw/mthca/mthca_dev.h
drivers/infiniband/hw/mthca/mthca_qp.c

index 96f1a86bf04950f54df57b36522ae008bfff00d5..16a851b341f8d0e8085e5e83e371dde64d89b0bd 100644 (file)
@@ -324,12 +324,11 @@ void mthca_cq_clean(struct mthca_dev *dev, u32 cqn, u32 qpn,
                wake_up(&cq->wait);
 }
 
-static int handle_error_cqe(struct mthca_dev *dev, struct mthca_cq *cq,
-                           struct mthca_qp *qp, int wqe_index, int is_send,
-                           struct mthca_err_cqe *cqe,
-                           struct ib_wc *entry, int *free_cqe)
+static void handle_error_cqe(struct mthca_dev *dev, struct mthca_cq *cq,
+                            struct mthca_qp *qp, int wqe_index, int is_send,
+                            struct mthca_err_cqe *cqe,
+                            struct ib_wc *entry, int *free_cqe)
 {
-       int err;
        int dbd;
        __be32 new_wqe;
 
@@ -412,11 +411,9 @@ static int handle_error_cqe(struct mthca_dev *dev, struct mthca_cq *cq,
         * error case, so we don't have to check the doorbell count, etc.
         */
        if (mthca_is_memfree(dev))
-               return 0;
+               return;
 
-       err = mthca_free_err_wqe(dev, qp, is_send, wqe_index, &dbd, &new_wqe);
-       if (err)
-               return err;
+       mthca_free_err_wqe(dev, qp, is_send, wqe_index, &dbd, &new_wqe);
 
        /*
         * If we're at the end of the WQE chain, or we've used up our
@@ -424,15 +421,13 @@ static int handle_error_cqe(struct mthca_dev *dev, struct mthca_cq *cq,
         * the next poll operation.
         */
        if (!(new_wqe & cpu_to_be32(0x3f)) || (!cqe->db_cnt && dbd))
-               return 0;
+               return;
 
        cqe->db_cnt   = cpu_to_be16(be16_to_cpu(cqe->db_cnt) - dbd);
        cqe->wqe      = new_wqe;
        cqe->syndrome = SYNDROME_WR_FLUSH_ERR;
 
        *free_cqe = 0;
-
-       return 0;
 }
 
 static inline int mthca_poll_one(struct mthca_dev *dev,
@@ -518,9 +513,9 @@ static inline int mthca_poll_one(struct mthca_dev *dev,
        }
 
        if (is_error) {
-               err = handle_error_cqe(dev, cq, *cur_qp, wqe_index, is_send,
-                                      (struct mthca_err_cqe *) cqe,
-                                      entry, &free_cqe);
+               handle_error_cqe(dev, cq, *cur_qp, wqe_index, is_send,
+                                (struct mthca_err_cqe *) cqe,
+                                entry, &free_cqe);
                goto out;
        }
 
index e481037288d61cbb642890754f999a965f9db5be..c98628ab8a09fc5fbb0787f9656b231d971bf4a9 100644 (file)
@@ -495,8 +495,8 @@ int mthca_arbel_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
                          struct ib_send_wr **bad_wr);
 int mthca_arbel_post_receive(struct ib_qp *ibqp, struct ib_recv_wr *wr,
                             struct ib_recv_wr **bad_wr);
-int mthca_free_err_wqe(struct mthca_dev *dev, struct mthca_qp *qp, int is_send,
-                      int index, int *dbd, __be32 *new_wqe);
+void mthca_free_err_wqe(struct mthca_dev *dev, struct mthca_qp *qp, int is_send,
+                       int index, int *dbd, __be32 *new_wqe);
 int mthca_alloc_qp(struct mthca_dev *dev,
                   struct mthca_pd *pd,
                   struct mthca_cq *send_cq,
index fba608ed7df2fca3c00cff0b4ef762ca9f0c52a5..79245717e98f67fbfc3c40a97ec4e348104d448a 100644 (file)
@@ -2182,8 +2182,8 @@ out:
        return err;
 }
 
-int mthca_free_err_wqe(struct mthca_dev *dev, struct mthca_qp *qp, int is_send,
-                      int index, int *dbd, __be32 *new_wqe)
+void mthca_free_err_wqe(struct mthca_dev *dev, struct mthca_qp *qp, int is_send,
+                       int index, int *dbd, __be32 *new_wqe)
 {
        struct mthca_next_seg *next;
 
@@ -2193,7 +2193,7 @@ int mthca_free_err_wqe(struct mthca_dev *dev, struct mthca_qp *qp, int is_send,
         */
        if (qp->ibqp.srq) {
                *new_wqe = 0;
-               return 0;
+               return;
        }
 
        if (is_send)
@@ -2207,8 +2207,6 @@ int mthca_free_err_wqe(struct mthca_dev *dev, struct mthca_qp *qp, int is_send,
                        (next->ee_nds & cpu_to_be32(0x3f));
        else
                *new_wqe = 0;
-
-       return 0;
 }
 
 int __devinit mthca_init_qp_table(struct mthca_dev *dev)