On Sun, Nov 15, 2015 at 01:30:56PM +0200, Hagay Abramovsky wrote:
> From: Haggai Abramonvsky <[email protected]>
> 
> +
> +int32_t mlx5_store_uidx(struct mlx5_context *ctx, void *rsc)
> +{
> +     int32_t tind;
> +     int32_t ret = -1;
You don't need this variable. Just initialize uidx and return uidx
always.
> +     int32_t uidx;
> +
> +     pthread_mutex_lock(&ctx->uidx_table_mutex);
> +     uidx = get_free_uidx(ctx);
> +     if (uidx < 0)
> +             goto out;
> +
> +     tind = uidx >> MLX5_UIDX_TABLE_SHIFT;
> +
> +     if (!ctx->uidx_table[tind].refcnt) {
> +             ctx->uidx_table[tind].table = calloc(MLX5_UIDX_TABLE_MASK + 1,
> +                                                  sizeof(void *));
> +             if (!ctx->uidx_table[tind].table)
> +                     goto out;
> +     }
> +
> +     ++ctx->uidx_table[tind].refcnt;
> +     ctx->uidx_table[tind].table[uidx & MLX5_UIDX_TABLE_MASK] = rsc;
> +     ret = uidx;
> +
> +out:
> +     pthread_mutex_unlock(&ctx->uidx_table_mutex);
> +     return ret;
> +}
> +
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to