This is just to make the error value more obvious. Callers don't
mind.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
migration/rdma.c | 43 ++++++++++++++++++++++---------------------
1 file changed, 22 insertions(+), 21 deletions(-)
diff --git a/migration/rdma.c b/migration/rdma.c
index d0af258468..ad314cc10a 100644
--- a/migration/rdma.c
+++ b/migration/rdma.c
@@ -1418,7 +1418,7 @@ static int qemu_rdma_unregister_waiting(RDMAContext *rdma)
ret = qemu_rdma_exchange_send(rdma, &head, (uint8_t *) ®,
&resp, NULL, NULL);
if (ret < 0) {
- return ret;
+ return -1;
}
trace_qemu_rdma_unregister_waiting_complete(chunk);
@@ -1459,7 +1459,7 @@ static int qemu_rdma_poll(RDMAContext *rdma, struct ibv_cq *cq,
if (ret < 0) {
error_report("ibv_poll_cq failed");
- return ret;
+ return -1;
}
wr_id = wc.wr_id & RDMA_WRID_TYPE_MASK;
@@ -1633,7 +1633,7 @@ static int qemu_rdma_block_for_wrid(RDMAContext *rdma,
while (wr_id != wrid_requested) {
ret = qemu_rdma_poll(rdma, poll_cq, &wr_id_in, byte_len);
if (ret < 0) {
- return ret;
+ return -1;
}
wr_id = wr_id_in & RDMA_WRID_TYPE_MASK;
@@ -1702,7 +1702,7 @@ err_block_for_wrid:
}
rdma->error_state = ret;
- return ret;
+ return -1;
}
/*
@@ -1757,9 +1757,10 @@ static int qemu_rdma_post_send_control(RDMAContext *rdma, uint8_t *buf,
ret = qemu_rdma_block_for_wrid(rdma, RDMA_WRID_SEND_CONTROL, NULL);
if (ret < 0) {
error_report("rdma migration: send polling control error");
+ return -1;
}
- return ret;
+ return 0;
}
/*
@@ -1801,7 +1802,7 @@ static int qemu_rdma_exchange_get_response(RDMAContext *rdma,
if (ret < 0) {
error_report("rdma migration: recv polling control error!");
- return ret;
+ return -1;
}
network_to_control((void *) rdma->wr_data[idx].control);
@@ -1879,7 +1880,7 @@ static int qemu_rdma_exchange_send(RDMAContext *rdma, RDMAControlHeader *head,
ret = qemu_rdma_exchange_get_response(rdma,
&resp, RDMA_CONTROL_READY, RDMA_WRID_READY);
if (ret < 0) {
- return ret;
+ return -1;
}
}
@@ -1891,7 +1892,7 @@ static int qemu_rdma_exchange_send(RDMAContext *rdma, RDMAControlHeader *head,
if (ret) {
error_report("rdma migration: error posting"
" extra control recv for anticipated result!");
- return ret;
+ return -1;
}
}
@@ -1901,7 +1902,7 @@ static int qemu_rdma_exchange_send(RDMAContext *rdma, RDMAControlHeader *head,
ret = qemu_rdma_post_recv_control(rdma, RDMA_WRID_READY);
if (ret) {
error_report("rdma migration: error posting first control recv!");
- return ret;
+ return -1;
}
/*
@@ -1911,7 +1912,7 @@ static int qemu_rdma_exchange_send(RDMAContext *rdma, RDMAControlHeader *head,
if (ret < 0) {
error_report("Failed to send control buffer!");
- return ret;
+ return -1;
}
/*
@@ -1922,7 +1923,7 @@ static int qemu_rdma_exchange_send(RDMAContext *rdma, RDMAControlHeader *head,
trace_qemu_rdma_exchange_send_issue_callback();
ret = callback(rdma);
if (ret < 0) {
- return ret;
+ return -1;
}
}
@@ -1931,7 +1932,7 @@ static int qemu_rdma_exchange_send(RDMAContext *rdma, RDMAControlHeader *head,
resp->type, RDMA_WRID_DATA);
if (ret < 0) {
- return ret;
+ return -1;
}
qemu_rdma_move_header(rdma, RDMA_WRID_DATA, resp);
@@ -1967,7 +1968,7 @@ static int qemu_rdma_exchange_recv(RDMAContext *rdma, RDMAControlHeader *head,
if (ret < 0) {
error_report("Failed to send control buffer!");
- return ret;
+ return -1;
}
/*
@@ -1977,7 +1978,7 @@ static int qemu_rdma_exchange_recv(RDMAContext *rdma, RDMAControlHeader *head,
expecting, RDMA_WRID_READY);
if (ret < 0) {
- return ret;
+ return -1;
}
qemu_rdma_move_header(rdma, RDMA_WRID_READY, head);
@@ -1988,7 +1989,7 @@ static int qemu_rdma_exchange_recv(RDMAContext *rdma, RDMAControlHeader *head,
ret = qemu_rdma_post_recv_control(rdma, RDMA_WRID_READY);
if (ret) {
error_report("rdma migration: error posting second control recv!");
- return ret;
+ return -1;
}
return 0;
@@ -2061,7 +2062,7 @@ retry:
"block %d chunk %" PRIu64
" current %" PRIu64 " len %" PRIu64 " %d",
current_index, chunk, sge.addr, length, rdma->nb_sent);
- return ret;
+ return -1;
}
}
@@ -2119,7 +2120,7 @@ retry:
ret = qemu_rdma_exchange_send(rdma, &head, (uint8_t *) ®,
&resp, ®_result_idx, NULL);
if (ret < 0) {
- return ret;
+ return -1;
}
/* try to overlap this single registration with the one we sent. */
@@ -2193,7 +2194,7 @@ retry:
if (ret < 0) {
error_report("rdma migration: failed to make "
"room in full send queue!");
- return ret;
+ return -1;
}
goto retry;
@@ -2230,7 +2231,7 @@ static int qemu_rdma_write_flush(QEMUFile *f, RDMAContext *rdma)
rdma->current_index, rdma->current_addr, rdma->current_length);
if (ret < 0) {
- return ret;
+ return -1;
}
if (ret == 0) {
@@ -2312,7 +2313,7 @@ static int qemu_rdma_write(QEMUFile *f, RDMAContext *rdma,
if (!qemu_rdma_buffer_mergable(rdma, current_addr, len)) {
ret = qemu_rdma_write_flush(f, rdma);
if (ret) {
- return ret;
+ return -1;
}
rdma->current_length = 0;
rdma->current_addr = current_addr;
@@ -3485,7 +3486,7 @@ err_rdma_dest_wait:
rdma->error_state = ret;
qemu_rdma_cleanup(rdma);
g_free(rdma_return_path);
- return ret;
+ return -1;
}
static int dest_ram_sort_func(const void *a, const void *b)
--
2.41.0