--- initial
+++ final
@@ -1,71 +1,70 @@
 struct smbd_mr *smbd_register_mr(struct smbd_connection *info, struct page *pages[], int num_pages, int offset, int tailsz, bool writing, bool need_invalidate) {
   struct smbd_mr *smbdirect_mr;
   int rc, i;
   enum dma_data_direction dir;
   struct ib_reg_wr *reg_wr;
-  struct ib_send_wr *bad_wr;
   if (num_pages > info->max_frmr_depth) {
     log_rdma_mr(ERR, "num_pages=%d max_frmr_depth=%d\n", num_pages, info->max_frmr_depth);
     return NULL;
   }
   smbdirect_mr = get_mr(info);
   if (!smbdirect_mr) {
     log_rdma_mr(ERR, "get_mr returning NULL\n");
     return NULL;
   }
   smbdirect_mr->need_invalidate = need_invalidate;
   smbdirect_mr->sgl_count = num_pages;
   sg_init_table(smbdirect_mr->sgl, num_pages);
   log_rdma_mr(INFO, "num_pages=0x%x offset=0x%x tailsz=0x%x\n", num_pages, offset, tailsz);
   if (num_pages == 1) {
     sg_set_page(&smbdirect_mr->sgl[0], pages[0], tailsz, offset);
     goto skip_multiple_pages;
   }
   /* We have at least two pages to register */
   sg_set_page(&smbdirect_mr->sgl[0], pages[0], PAGE_SIZE - offset, offset);
   i = 1;
   while (i < num_pages - 1) {
     sg_set_page(&smbdirect_mr->sgl[i], pages[i], PAGE_SIZE, 0);
     i++;
   }
   sg_set_page(&smbdirect_mr->sgl[i], pages[i], tailsz ? tailsz : PAGE_SIZE, 0);
 skip_multiple_pages:
   dir = writing ? DMA_FROM_DEVICE : DMA_TO_DEVICE;
   smbdirect_mr->dir = dir;
   rc = ib_dma_map_sg(info->id->device, smbdirect_mr->sgl, num_pages, dir);
   if (!rc) {
     log_rdma_mr(ERR, "ib_dma_map_sg num_pages=%x dir=%x rc=%x\n", num_pages, dir, rc);
     goto dma_map_error;
   }
   rc = ib_map_mr_sg(smbdirect_mr->mr, smbdirect_mr->sgl, num_pages, NULL, PAGE_SIZE);
   if (rc != num_pages) {
     log_rdma_mr(ERR, "ib_map_mr_sg failed rc = %d num_pages = %x\n", rc, num_pages);
     goto map_mr_error;
   }
   ib_update_fast_reg_key(smbdirect_mr->mr, ib_inc_rkey(smbdirect_mr->mr->rkey));
   reg_wr = &smbdirect_mr->wr;
   reg_wr->wr.opcode = IB_WR_REG_MR;
   smbdirect_mr->cqe.done = register_mr_done;
   reg_wr->wr.wr_cqe = &smbdirect_mr->cqe;
   reg_wr->wr.num_sge = 0;
   reg_wr->wr.send_flags = IB_SEND_SIGNALED;
   reg_wr->mr = smbdirect_mr->mr;
   reg_wr->key = smbdirect_mr->mr->rkey;
   reg_wr->access = writing ? IB_ACCESS_REMOTE_WRITE | IB_ACCESS_LOCAL_WRITE : IB_ACCESS_REMOTE_READ;
   /*
    * There is no need for waiting for complemtion on ib_post_send
    * on IB_WR_REG_MR. Hardware enforces a barrier and order of execution
    * on the next ib_post_send when we actaully send I/O to remote peer
    */
-  rc = ib_post_send(info->id->qp, &reg_wr->wr, &bad_wr);
+  rc = ib_post_send(info->id->qp, &reg_wr->wr, NULL);
   if (!rc) return smbdirect_mr;
   log_rdma_mr(ERR, "ib_post_send failed rc=%x reg_wr->key=%x\n", rc, reg_wr->key);
   /* If all failed, attempt to recover this MR by setting it MR_ERROR*/
 map_mr_error:
   ib_dma_unmap_sg(info->id->device, smbdirect_mr->sgl, smbdirect_mr->sgl_count, smbdirect_mr->dir);
 dma_map_error:
   smbdirect_mr->state = MR_ERROR;
   if (atomic_dec_and_test(&info->mr_used_count)) wake_up(&info->wait_for_mr_cleanup);
   smbd_disconnect_rdma_connection(info);
   return NULL;
 }<sep>@@
identifier bad_send_wr;
expression e1,e2,e;
@@

-struct ib_send_wr *bad_send_wr;
<+... when != bad_send_wr
(
-   bad_send_wr = &e;
|
    ib_post_send(e1,e2,
-		   &bad_send_wr
+		   NULL
		)
)
...+>