if (pcmd) kfree(pcmd); 
kfree(pcmd); 
lpfc_prep_els_iocb(struct lpfc_hba * phba,		   uint8_t expectRsp,		   uint16_t cmdSize,		   uint8_t retry, struct lpfc_nodelist * ndlp, uint32_t elscmd){	struct lpfc_sli_ring *pring;	struct lpfc_iocbq *elsiocb;	struct lpfc_dmabuf *pcmd, *prsp, *pbuflist;	struct ulp_bde64 *bpl;	IOCB_t *icmd;	pring = &phba->sli.ring[LPFC_ELS_RING];	if (phba->hba_state < LPFC_LINK_UP)		return  NULL;	/* Allocate buffer for  command iocb */	spin_lock_irq(phba->host->host_lock);	elsiocb = lpfc_sli_get_iocbq(phba);	spin_unlock_irq(phba->host->host_lock);	if (elsiocb == NULL)		return NULL;	icmd = &elsiocb->iocb;	/* fill in BDEs for command */	/* Allocate buffer for command payload */	if (((pcmd = kmalloc(sizeof (struct lpfc_dmabuf), GFP_KERNEL)) == 0) ||	    ((pcmd->virt = lpfc_mbuf_alloc(phba,					   MEM_PRI, &(pcmd->phys))) == 0)) {		if (pcmd)			kfree(pcmd);		spin_lock_irq(phba->host->host_lock);		lpfc_sli_release_iocbq(phba, elsiocb);		spin_unlock_irq(phba->host->host_lock);		return NULL;	}	INIT_LIST_HEAD(&pcmd->list);	/* Allocate buffer for response payload */	if (expectRsp) {		prsp = kmalloc(sizeof (struct lpfc_dmabuf), GFP_KERNEL);		if (prsp)			prsp->virt = lpfc_mbuf_alloc(phba, MEM_PRI,						     &prsp->phys);		if (prsp == 0 || prsp->virt == 0) {			if (prsp)				kfree(prsp);			lpfc_mbuf_free(phba, pcmd->virt, pcmd->phys);			kfree(pcmd);			spin_lock_irq(phba->host->host_lock);			lpfc_sli_release_iocbq(phba, elsiocb);			spin_unlock_irq(phba->host->host_lock);			return NULL;		}		INIT_LIST_HEAD(&prsp->list);	} else {		prsp = NULL;	}	/* Allocate buffer for Buffer ptr list */	pbuflist = kmalloc(sizeof (struct lpfc_dmabuf), GFP_KERNEL);	if (pbuflist)	    pbuflist->virt = lpfc_mbuf_alloc(phba, MEM_PRI,					     &pbuflist->phys);	if (pbuflist == 0 || pbuflist->virt == 0) {		spin_lock_irq(phba->host->host_lock);		lpfc_sli_release_iocbq(phba, elsiocb);		spin_unlock_irq(phba->host->host_lock);		lpfc_mbuf_free(phba, pcmd->virt, pcmd->phys);		lpfc_mbuf_free(phba, prsp->virt, prsp->phys);		kfree(pcmd);		kfree(prsp);		if (pbuflist)			kfree(pbuflist);		return NULL;	}	INIT_LIST_HEAD(&pbuflist->list);	icmd->un.elsreq64.bdl.addrHigh = putPaddrHigh(pbuflist->phys);	icmd->un.elsreq64.bdl.addrLow = putPaddrLow(pbuflist->phys);	icmd->un.elsreq64.bdl.bdeFlags = BUFF_TYPE_BDL;	if (expectRsp) {		icmd->un.elsreq64.bdl.bdeSize = (2 * sizeof (struct ulp_bde64));		icmd->un.elsreq64.remoteID = ndlp->nlp_DID;	/* DID */		icmd->ulpCommand = CMD_ELS_REQUEST64_CR;	} else {		icmd->un.elsreq64.bdl.bdeSize = sizeof (struct ulp_bde64);		icmd->ulpCommand = CMD_XMIT_ELS_RSP64_CX;	}	icmd->ulpBdeCount = 1;	icmd->ulpLe = 1;	icmd->ulpClass = CLASS3;	bpl = (struct ulp_bde64 *) pbuflist->virt;	bpl->addrLow = le32_to_cpu(putPaddrLow(pcmd->phys));	bpl->addrHigh = le32_to_cpu(putPaddrHigh(pcmd->phys));	bpl->tus.f.bdeSize = cmdSize;	bpl->tus.f.bdeFlags = 0;	bpl->tus.w = le32_to_cpu(bpl->tus.w);	if (expectRsp) {		bpl++;		bpl->addrLow = le32_to_cpu(putPaddrLow(prsp->phys));		bpl->addrHigh = le32_to_cpu(putPaddrHigh(prsp->phys));		bpl->tus.f.bdeSize = FCELSSIZE;		bpl->tus.f.bdeFlags = BUFF_USE_RCV;		bpl->tus.w = le32_to_cpu(bpl->tus.w);	}	/* Save for completion so we can release these resources */	elsiocb->context1 = (uint8_t *) ndlp;	elsiocb->context2 = (uint8_t *) pcmd;	elsiocb->context3 = (uint8_t *) pbuflist;	elsiocb->retry = retry;	elsiocb->drvrTimeout = (phba->fc_ratov << 1) + LPFC_DRVR_TIMEOUT;	if (prsp) {		list_add(&prsp->list, &pcmd->list);	}	if (expectRsp) {		/* Xmit ELS command <elsCmd> to remote NPORT <did> */		lpfc_printf_log(phba, KERN_INFO, LOG_ELS,				"%d:0116 Xmit ELS command x%x to remote "				"NPORT x%x Data: x%x x%x\n",				phba->brd_no, elscmd,				ndlp->nlp_DID, icmd->ulpIoTag, phba->hba_state);	} else {		/* Xmit ELS response <elsCmd> to remote NPORT <did> */		lpfc_printf_log(phba, KERN_INFO, LOG_ELS,				"%d:0117 Xmit ELS response x%x to remote "				"NPORT x%x Data: x%x x%x\n",				phba->brd_no, elscmd,				ndlp->nlp_DID, icmd->ulpIoTag, cmdSize);	}	return (elsiocb);}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/c9475cb0c358ff0dd473544280d92482df491913/lpfc_els.c/clean/drivers/scsi/lpfc/lpfc_els.c