--- initial
+++ final
@@ -1,121 +1,121 @@
 static ssize_t ib_umad_write(struct file *filp, const char __user *buf, size_t count, loff_t *pos) {
   struct ib_umad_file *file = filp->private_data;
   struct ib_umad_packet *packet;
   struct ib_mad_agent *agent;
   struct rdma_ah_attr ah_attr;
   struct ib_ah *ah;
   struct ib_rmpp_mad *rmpp_mad;
   __be64 *tid;
   int ret, data_len, hdr_len, copy_offset, rmpp_active;
   u8 base_version;
   if (count < hdr_size(file) + IB_MGMT_RMPP_HDR) return -EINVAL;
   packet = kzalloc(sizeof *packet + IB_MGMT_RMPP_HDR, GFP_KERNEL);
   if (!packet) return -ENOMEM;
   if (copy_from_user(&packet->mad, buf, hdr_size(file))) {
     ret = -EFAULT;
     goto err;
   }
   if (packet->mad.hdr.id >= IB_UMAD_MAX_AGENTS) {
     ret = -EINVAL;
     goto err;
   }
   buf += hdr_size(file);
   if (copy_from_user(packet->mad.data, buf, IB_MGMT_RMPP_HDR)) {
     ret = -EFAULT;
     goto err;
   }
   mutex_lock(&file->mutex);
   agent = __get_agent(file, packet->mad.hdr.id);
   if (!agent) {
     ret = -EINVAL;
     goto err_up;
   }
   memset(&ah_attr, 0, sizeof ah_attr);
   ah_attr.dlid = be16_to_cpu(packet->mad.hdr.lid);
   ah_attr.sl = packet->mad.hdr.sl;
   ah_attr.src_path_bits = packet->mad.hdr.path_bits;
   ah_attr.port_num = file->port->port_num;
   if (packet->mad.hdr.grh_present) {
     ah_attr.ah_flags = IB_AH_GRH;
     memcpy(ah_attr.grh.dgid.raw, packet->mad.hdr.gid, 16);
     ah_attr.grh.sgid_index = packet->mad.hdr.gid_index;
     ah_attr.grh.flow_label = be32_to_cpu(packet->mad.hdr.flow_label);
     ah_attr.grh.hop_limit = packet->mad.hdr.hop_limit;
     ah_attr.grh.traffic_class = packet->mad.hdr.traffic_class;
   }
   ah = rdma_create_ah(agent->qp->pd, &ah_attr);
   if (IS_ERR(ah)) {
     ret = PTR_ERR(ah);
     goto err_up;
   }
   rmpp_mad = (struct ib_rmpp_mad *)packet->mad.data;
   hdr_len = ib_get_mad_data_offset(rmpp_mad->mad_hdr.mgmt_class);
   if (ib_is_mad_class_rmpp(rmpp_mad->mad_hdr.mgmt_class) && ib_mad_kernel_rmpp_agent(agent)) {
     copy_offset = IB_MGMT_RMPP_HDR;
     rmpp_active = ib_get_rmpp_flags(&rmpp_mad->rmpp_hdr) & IB_MGMT_RMPP_FLAG_ACTIVE;
   } else {
     copy_offset = IB_MGMT_MAD_HDR;
     rmpp_active = 0;
   }
   base_version = ((struct ib_mad_hdr *)&packet->mad.data)->base_version;
   data_len = count - hdr_size(file) - hdr_len;
   packet->msg = ib_create_send_mad(agent, be32_to_cpu(packet->mad.hdr.qpn), packet->mad.hdr.pkey_index, rmpp_active, hdr_len, data_len, GFP_KERNEL, base_version);
   if (IS_ERR(packet->msg)) {
     ret = PTR_ERR(packet->msg);
     goto err_ah;
   }
   packet->msg->ah = ah;
   packet->msg->timeout_ms = packet->mad.hdr.timeout_ms;
   packet->msg->retries = packet->mad.hdr.retries;
   packet->msg->context[0] = packet;
   /* Copy MAD header.  Any RMPP header is already in place. */
   memcpy(packet->msg->mad, packet->mad.data, IB_MGMT_MAD_HDR);
   if (!rmpp_active) {
     if (copy_from_user(packet->msg->mad + copy_offset, buf + copy_offset, hdr_len + data_len - copy_offset)) {
       ret = -EFAULT;
       goto err_msg;
     }
   } else {
     ret = copy_rmpp_mad(packet->msg, buf);
     if (ret) goto err_msg;
   }
   /*
    * Set the high-order part of the transaction ID to make MADs from
    * different agents unique, and allow routing responses back to the
    * original requestor.
    */
   if (!ib_response_mad(packet->msg->mad)) {
     tid = &((struct ib_mad_hdr *)packet->msg->mad)->tid;
     *tid = cpu_to_be64(((u64)agent->hi_tid) << 32 | (be64_to_cpup(tid) & 0xffffffff));
     rmpp_mad->mad_hdr.tid = *tid;
   }
   if (!ib_mad_kernel_rmpp_agent(agent) && ib_is_mad_class_rmpp(rmpp_mad->mad_hdr.mgmt_class) && (ib_get_rmpp_flags(&rmpp_mad->rmpp_hdr) & IB_MGMT_RMPP_FLAG_ACTIVE)) {
     spin_lock_irq(&file->send_lock);
     list_add_tail(&packet->list, &file->send_list);
     spin_unlock_irq(&file->send_lock);
   } else {
     spin_lock_irq(&file->send_lock);
     ret = is_duplicate(file, packet);
     if (!ret) list_add_tail(&packet->list, &file->send_list);
     spin_unlock_irq(&file->send_lock);
     if (ret) {
       ret = -EINVAL;
       goto err_msg;
     }
   }
   ret = ib_post_send_mad(packet->msg, NULL);
   if (ret) goto err_send;
   mutex_unlock(&file->mutex);
   return count;
 err_send:
   dequeue_send(file, packet);
 err_msg:
   ib_free_send_mad(packet->msg);
 err_ah:
-  ib_destroy_ah(ah);
+  rdma_destroy_ah(ah);
 err_up:
   mutex_unlock(&file->mutex);
 err:
   kfree(packet);
   return ret;
 }<sep>@@
expression ad;
@@

-       ib_destroy_ah
+       rdma_destroy_ah
	(ah)