From 0c5a48438e94a050545d8ca1199af4d19f399f1f Mon Sep 17 00:00:00 2001 From: zhujun2 Date: Tue, 16 Jan 2024 23:47:01 -0800 Subject: [PATCH] migration/rdma: Remove all "ret" variables that are used only once mainline inclusion commit 8f5a7faa4e60e93cf4f014ed100efa4206f6d7ae category: bugfix --------------------------------------------------------------- Change code that is: int ret; ... ret = foo(); if (ret[ < 0]?) { to: if (foo()[ < 0]) { Reviewed-by: Fabiano Rosas Reviewed-by: Li Zhijian Signed-off-by: Juan Quintela Message-ID: <20231011203527.9061-14-quintela@redhat.com> Signed-off-by: zhujun2 --- migration/rdma.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/migration/rdma.c b/migration/rdma.c index 60c856dd2f..ee1f153b6f 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -1121,7 +1121,6 @@ err_alloc_pd_cq: static int qemu_rdma_alloc_qp(RDMAContext *rdma) { struct ibv_qp_init_attr attr = { 0 }; - int ret; attr.cap.max_send_wr = RDMA_SIGNALED_SEND_MAX; attr.cap.max_recv_wr = 3; @@ -1131,8 +1130,7 @@ static int qemu_rdma_alloc_qp(RDMAContext *rdma) attr.recv_cq = rdma->recv_cq; attr.qp_type = IBV_QPT_RC; - ret = rdma_create_qp(rdma->cm_id, rdma->pd, &attr); - if (ret) { + if (rdma_create_qp(rdma->cm_id, rdma->pd, &attr) < 0) { return -1; } @@ -1144,8 +1142,7 @@ static int qemu_rdma_alloc_qp(RDMAContext *rdma) static bool rdma_support_odp(struct ibv_context *dev) { struct ibv_device_attr_ex attr = {0}; - int ret = ibv_query_device_ex(dev, NULL, &attr); - if (ret) { + if (ibv_query_device_ex(dev, NULL, &attr)) { return false; } -- Gitee