]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
msg/async/rdma: cosmetics initialize ibv_send_wr* var
authorChangcheng Liu <changcheng.liu@aliyun.com>
Thu, 27 Jun 2019 05:19:58 +0000 (13:19 +0800)
committerChangcheng Liu <changcheng.liu@aliyun.com>
Fri, 23 Aug 2019 03:35:55 +0000 (11:35 +0800)
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 <changcheng.liu@aliyun.com>
src/msg/async/rdma/RDMAConnectedSocketImpl.cc

index c4d675471f77850918bfeba2b8df6c08b171a981..e60cd9b3631584484deacb1980901e22863c9b27 100644 (file)
@@ -578,7 +578,7 @@ int RDMAConnectedSocketImpl::post_work_request(std::vector<Chunk*> &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): "