mthca_align_qp_size(dev, &sqp->qp); 
err = mthca_set_qp_size(dev, cap, &sqp->qp); if (err) return err; 
int mthca_alloc_sqp(struct mthca_dev *dev,		    struct mthca_pd *pd,		    struct mthca_cq *send_cq,		    struct mthca_cq *recv_cq,		    enum ib_sig_type send_policy,		    int qpn,		    int port,		    struct mthca_sqp *sqp){	int err = 0;	u32 mqpn = qpn * 2 + dev->qp_table.sqp_start + port - 1;	mthca_align_qp_size(dev, &sqp->qp);	sqp->header_buf_size = sqp->qp.sq.max * MTHCA_UD_HEADER_SIZE;	sqp->header_buf = dma_alloc_coherent(&dev->pdev->dev, sqp->header_buf_size,					     &sqp->header_dma, GFP_KERNEL);	if (!sqp->header_buf)		return -ENOMEM;	spin_lock_irq(&dev->qp_table.lock);	if (mthca_array_get(&dev->qp_table.qp, mqpn))		err = -EBUSY;	else		mthca_array_set(&dev->qp_table.qp, mqpn, sqp);	spin_unlock_irq(&dev->qp_table.lock);	if (err)		goto err_out;	sqp->port = port;	sqp->qp.qpn       = mqpn;	sqp->qp.transport = MLX;	err = mthca_alloc_qp_common(dev, pd, send_cq, recv_cq,				    send_policy, &sqp->qp);	if (err)		goto err_out_free;	atomic_inc(&pd->sqp_count);	return 0; err_out_free:	/*	 * 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, mqpn);	spin_unlock(&dev->qp_table.lock);	if (send_cq != recv_cq)		spin_unlock(&recv_cq->lock);	spin_unlock_irq(&send_cq->lock); err_out:	dma_free_coherent(&dev->pdev->dev, sqp->header_buf_size,			  sqp->header_buf, sqp->header_dma);	return err;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/80c8ec2c04e539aac4e9810a46bc04c1b424b4dd/mthca_qp.c/buggy/drivers/infiniband/hw/mthca/mthca_qp.c