Skip to content

Commit

Permalink
RDMA/amso1100: Fix error paths in post_send and post_recv
Browse files Browse the repository at this point in the history
Always set bad_wr when an immediate error is detected.

Signed-off-by: Frank Zago <fzago@systemfabricworks.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
  • Loading branch information
Frank Zago authored and Roland Dreier committed Dec 9, 2009
1 parent 91d3f9b commit c597b02
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions drivers/infiniband/hw/amso1100/c2_qp.c
Original file line number Diff line number Diff line change
@@ -798,8 +798,10 @@ int c2_post_send(struct ib_qp *ibqp, struct ib_send_wr *ib_wr,
u8 actual_sge_count;
u32 msg_size;

if (qp->state > IB_QPS_RTS)
return -EINVAL;
if (qp->state > IB_QPS_RTS) {
err = -EINVAL;
goto out;
}

while (ib_wr) {

@@ -930,6 +932,7 @@ int c2_post_send(struct ib_qp *ibqp, struct ib_send_wr *ib_wr,
ib_wr = ib_wr->next;
}

out:
if (err)
*bad_wr = ib_wr;
return err;
@@ -944,8 +947,10 @@ int c2_post_receive(struct ib_qp *ibqp, struct ib_recv_wr *ib_wr,
unsigned long lock_flags;
int err = 0;

if (qp->state > IB_QPS_RTS)
return -EINVAL;
if (qp->state > IB_QPS_RTS) {
err = -EINVAL;
goto out;
}

/*
* Try and post each work request
@@ -998,6 +1003,7 @@ int c2_post_receive(struct ib_qp *ibqp, struct ib_recv_wr *ib_wr,
ib_wr = ib_wr->next;
}

out:
if (err)
*bad_wr = ib_wr;
return err;

0 comments on commit c597b02

Please sign in to comment.