kfree(qp->wrid);  mthca_free_memfree(dev, qp); 
mthca_unmap_memfree(dev, qp); 
void mthca_free_qp(struct mthca_dev *dev,		   struct mthca_qp *qp){	u8 status;	int size;	int i;	struct mthca_cq *send_cq;	struct mthca_cq *recv_cq;	send_cq = to_mcq(qp->ibqp.send_cq);	recv_cq = to_mcq(qp->ibqp.recv_cq);	/*	 * Lock CQs here, so that CQ polling code can do QP lookup	 * without taking a lock.	 */	spin_lock_irq(&send_cq->lock);	if (send_cq != recv_cq)		spin_lock(&recv_cq->lock);	spin_lock(&dev->qp_table.lock);	mthca_array_clear(&dev->qp_table.qp,			  qp->qpn & (dev->limits.num_qps - 1));	spin_unlock(&dev->qp_table.lock);	if (send_cq != recv_cq)		spin_unlock(&recv_cq->lock);	spin_unlock_irq(&send_cq->lock);	atomic_dec(&qp->refcount);	wait_event(qp->wait, !atomic_read(&qp->refcount));	if (qp->state != IB_QPS_RESET)		mthca_MODIFY_QP(dev, MTHCA_TRANS_ANY2RST, qp->qpn, 0, NULL, 0, &status);	mthca_cq_clean(dev, to_mcq(qp->ibqp.send_cq)->cqn, qp->qpn);	if (qp->ibqp.send_cq != qp->ibqp.recv_cq)		mthca_cq_clean(dev, to_mcq(qp->ibqp.recv_cq)->cqn, qp->qpn);	mthca_free_mr(dev, &qp->mr);	size = PAGE_ALIGN(qp->send_wqe_offset +			  (qp->sq.max << qp->sq.wqe_shift));	if (qp->is_direct) {		pci_free_consistent(dev->pdev, size,				    qp->queue.direct.buf,				    pci_unmap_addr(&qp->queue.direct, mapping));	} else {		for (i = 0; i < size / PAGE_SIZE; ++i) {			pci_free_consistent(dev->pdev, PAGE_SIZE,					    qp->queue.page_list[i].buf,					    pci_unmap_addr(&qp->queue.page_list[i],							   mapping));		}	}	kfree(qp->wrid);	mthca_free_memfree(dev, qp);	if (is_sqp(dev, qp)) {		atomic_dec(&(to_mpd(qp->ibqp.pd)->sqp_count));		dma_free_coherent(&dev->pdev->dev,				  to_msqp(qp)->header_buf_size,				  to_msqp(qp)->header_buf,				  to_msqp(qp)->header_dma);	} else		mthca_free(&dev->qp_table.alloc, qp->qpn);}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/80c8ec2c04e539aac4e9810a46bc04c1b424b4dd/mthca_qp.c/buggy/drivers/infiniband/hw/mthca/mthca_qp.c