diff options
author | Michael S. Tsirkin <mst@mellanox.co.il> | 2005-12-15 16:11:18 +0000 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2006-11-09 19:57:04 -0800 |
commit | 182c04e4c642169d17e4415240be0a57b01d8567 (patch) | |
tree | 1f2adae439765104f98973724da98b1c13cd47f9 | |
parent | 33efbbddefb44fba3cc6fd9ef726567433f3912c (diff) | |
download | libmthca-182c04e4c642169d17e4415240be0a57b01d8567.tar.gz |
Only increment qp_table ref count if allocation succeeds
Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | src/qp.c | 3 |
2 files changed, 7 insertions, 1 deletions
@@ -1,3 +1,8 @@ +2005-12-15 Michael S. Tsirkin <mst@mellanox.co.il> + + * src/qp.c (mthca_store_qp): Don't increment qp_table ref count if + allocation fails. + 2005-11-29 Michael S. Tsirkin <mst@mellanox.co.il> * src/qp.c (mthca_arbel_post_send): Add handling for posting long @@ -875,7 +875,7 @@ int mthca_store_qp(struct mthca_context *ctx, uint32_t qpn, struct mthca_qp *qp) pthread_mutex_lock(&ctx->qp_table_mutex); - if (!ctx->qp_table[tind].refcnt++) { + if (!ctx->qp_table[tind].refcnt) { ctx->qp_table[tind].table = calloc(ctx->qp_table_mask + 1, sizeof (struct mthca_qp *)); if (!ctx->qp_table[tind].table) { @@ -884,6 +884,7 @@ int mthca_store_qp(struct mthca_context *ctx, uint32_t qpn, struct mthca_qp *qp) } } + ++ctx->qp_table[tind].refcnt; ctx->qp_table[tind].table[qpn & ctx->qp_table_mask] = qp; out: |