wr.wr.ud.ah      = dev->sm_ah[port_num - 1]; if (wr.wr.ud.ah) ret = ib_post_send_mad(agent, &wr, &bad_wr); 
memcpy(send_buf->mad, mad, sizeof *mad); if ((send_buf->ah = dev->sm_ah[port_num - 1])) ret = ib_post_send_mad(send_buf, NULL); 
static void forward_trap(struct mthca_dev *dev,			 u8 port_num,			 struct ib_mad *mad){	int qpn = mad->mad_hdr.mgmt_class != IB_MGMT_CLASS_SUBN_LID_ROUTED;	struct mthca_trap_mad *tmad;	struct ib_sge      gather_list;	struct ib_send_wr *bad_wr, wr = {		.opcode      = IB_WR_SEND,		.sg_list     = &gather_list,		.num_sge     = 1,		.send_flags  = IB_SEND_SIGNALED,		.wr	     = {			 .ud = {				 .remote_qpn  = qpn,				 .remote_qkey = qpn ? IB_QP1_QKEY : 0,				 .timeout_ms  = 0			 }		 }	};	struct ib_mad_agent *agent = dev->send_agent[port_num - 1][qpn];	int ret;	unsigned long flags;	if (agent) {		tmad = kmalloc(sizeof *tmad, GFP_KERNEL);		if (!tmad)			return;		tmad->mad = kmalloc(sizeof *tmad->mad, GFP_KERNEL);		if (!tmad->mad) {			kfree(tmad);			return;		}		memcpy(tmad->mad, mad, sizeof *mad);		wr.wr.ud.mad_hdr = &tmad->mad->mad_hdr;		wr.wr_id         = (unsigned long) tmad;		gather_list.addr   = dma_map_single(agent->device->dma_device,						    tmad->mad,						    sizeof *tmad->mad,						    DMA_TO_DEVICE);		gather_list.length = sizeof *tmad->mad;		gather_list.lkey   = to_mpd(agent->qp->pd)->ntmr.ibmr.lkey;		pci_unmap_addr_set(tmad, mapping, gather_list.addr);		/*		 * We rely here on the fact that MLX QPs don't use the		 * address handle after the send is posted (this is		 * wrong following the IB spec strictly, but we know		 * it's OK for our devices).		 */		spin_lock_irqsave(&dev->sm_lock, flags);		wr.wr.ud.ah      = dev->sm_ah[port_num - 1];		if (wr.wr.ud.ah)			ret = ib_post_send_mad(agent, &wr, &bad_wr);		else			ret = -EINVAL;		spin_unlock_irqrestore(&dev->sm_lock, flags);		if (ret) {			dma_unmap_single(agent->device->dma_device,					 pci_unmap_addr(tmad, mapping),					 sizeof *tmad->mad,					 DMA_TO_DEVICE);			kfree(tmad->mad);			kfree(tmad);		}	}}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/34816ad98efe4d47ffd858a0345321f9d85d9420/mthca_mad.c/buggy/drivers/infiniband/hw/mthca/mthca_mad.c