From 60a87c9db99fceda9f6d4efee46b9f06175bcec0 Mon Sep 17 00:00:00 2001 From: Changcheng Liu Date: Thu, 27 Jun 2019 13:19:58 +0800 Subject: [PATCH] msg/async/rdma: cosmetics initialize ibv_send_wr* var API usage: int ibv_post_send(struct ibv_qp *qp, struct ibv_send_wr *wr, struct ibv_send_wr **bad_wr) Input Parameters: qp struct ibv_qp from ibv_create_qp wr first work request (WR) Output Parameters: bad_wr pointer to first rejected WR Return Value: 0 on success, -1 on error. If the call fails, errno will be set to indicate the reason for the failure. To avoid wrong checking return value, it's better to initialize the value to be nullptr. Signed-off-by: Changcheng Liu --- src/msg/async/rdma/RDMAConnectedSocketImpl.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/msg/async/rdma/RDMAConnectedSocketImpl.cc b/src/msg/async/rdma/RDMAConnectedSocketImpl.cc index c4d675471f7..e60cd9b3631 100644 --- a/src/msg/async/rdma/RDMAConnectedSocketImpl.cc +++ b/src/msg/async/rdma/RDMAConnectedSocketImpl.cc @@ -578,7 +578,7 @@ int RDMAConnectedSocketImpl::post_work_request(std::vector &tx_buffers) ++current_buffer; } - ibv_send_wr *bad_tx_work_request; + ibv_send_wr *bad_tx_work_request = nullptr; if (ibv_post_send(qp->get_qp(), iswr, &bad_tx_work_request)) { ldout(cct, 1) << __func__ << " failed to send data" << " (most probably should be peer not ready): " @@ -600,7 +600,7 @@ void RDMAConnectedSocketImpl::fin() { wr.num_sge = 0; wr.opcode = IBV_WR_SEND; wr.send_flags = IBV_SEND_SIGNALED; - ibv_send_wr* bad_tx_work_request; + ibv_send_wr* bad_tx_work_request = nullptr; if (ibv_post_send(qp->get_qp(), &wr, &bad_tx_work_request)) { ldout(cct, 1) << __func__ << " failed to send message=" << " ibv_post_send failed(most probably should be peer not ready): "