diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c
index 14ee4fdcf17210c1a35495756cd8441d286da428..afa873bd028ed5ad76f2348bbe9789b0b225b476 100644
--- a/drivers/infiniband/hw/mlx5/mr.c
+++ b/drivers/infiniband/hw/mlx5/mr.c
@@ -721,7 +721,7 @@ void mlx5_umr_cq_handler(struct ib_cq *cq, void *cq_context)
 		if (err == 0)
 			break;
 
-		context = (struct mlx5_ib_umr_context *)wc.wr_id;
+		context = (struct mlx5_ib_umr_context *) (unsigned long) wc.wr_id;
 		context->status = wc.status;
 		complete(&context->done);
 	}