Commit 45371aa3 authored by Jitendra Bhivare's avatar Jitendra Bhivare Committed by Martin K. Petersen

scsi: be2iscsi: Free msi_name and disable HW intr

In beiscsi_dev_probe, allocated msi_name does not get freed and enabled
HW interrupts are not disabled in iscsi_host_add error case.

Add beiscsi_free_irqs fn to handle the cleanup in probe and disable port.
Signed-off-by: default avatarJitendra Bhivare <jitendra.bhivare@broadcom.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 8dd998e6
...@@ -790,6 +790,24 @@ static irqreturn_t be_isr(int irq, void *dev_id) ...@@ -790,6 +790,24 @@ static irqreturn_t be_isr(int irq, void *dev_id)
return IRQ_HANDLED; return IRQ_HANDLED;
} }
static void beiscsi_free_irqs(struct beiscsi_hba *phba)
{
struct hwi_context_memory *phwi_context;
int i;
if (!phba->pcidev->msix_enabled) {
if (phba->pcidev->irq)
free_irq(phba->pcidev->irq, phba);
return;
}
phwi_context = phba->phwi_ctrlr->phwi_ctxt;
for (i = 0; i <= phba->num_cpus; i++) {
free_irq(pci_irq_vector(phba->pcidev, i),
&phwi_context->be_eq[i]);
kfree(phba->msi_name[i]);
}
}
static int beiscsi_init_irqs(struct beiscsi_hba *phba) static int beiscsi_init_irqs(struct beiscsi_hba *phba)
{ {
...@@ -5396,15 +5414,7 @@ static void beiscsi_disable_port(struct beiscsi_hba *phba, int unload) ...@@ -5396,15 +5414,7 @@ static void beiscsi_disable_port(struct beiscsi_hba *phba, int unload)
phwi_ctrlr = phba->phwi_ctrlr; phwi_ctrlr = phba->phwi_ctrlr;
phwi_context = phwi_ctrlr->phwi_ctxt; phwi_context = phwi_ctrlr->phwi_ctxt;
hwi_disable_intr(phba); hwi_disable_intr(phba);
if (phba->pcidev->msix_enabled) { beiscsi_free_irqs(phba);
for (i = 0; i <= phba->num_cpus; i++) {
free_irq(pci_irq_vector(phba->pcidev, i),
&phwi_context->be_eq[i]);
kfree(phba->msi_name[i]);
}
} else
if (phba->pcidev->irq)
free_irq(phba->pcidev->irq, phba);
pci_free_irq_vectors(phba->pcidev); pci_free_irq_vectors(phba->pcidev);
for (i = 0; i < phba->num_cpus; i++) { for (i = 0; i < phba->num_cpus; i++) {
...@@ -5595,12 +5605,12 @@ static int beiscsi_dev_probe(struct pci_dev *pcidev, ...@@ -5595,12 +5605,12 @@ static int beiscsi_dev_probe(struct pci_dev *pcidev,
if (ret) { if (ret) {
beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT, beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
"BM_%d : be_ctrl_init failed\n"); "BM_%d : be_ctrl_init failed\n");
goto hba_free; goto free_hba;
} }
ret = beiscsi_init_sliport(phba); ret = beiscsi_init_sliport(phba);
if (ret) if (ret)
goto hba_free; goto free_hba;
spin_lock_init(&phba->io_sgl_lock); spin_lock_init(&phba->io_sgl_lock);
spin_lock_init(&phba->mgmt_sgl_lock); spin_lock_init(&phba->mgmt_sgl_lock);
...@@ -5680,13 +5690,13 @@ static int beiscsi_dev_probe(struct pci_dev *pcidev, ...@@ -5680,13 +5690,13 @@ static int beiscsi_dev_probe(struct pci_dev *pcidev,
beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT, beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
"BM_%d : beiscsi_dev_probe-" "BM_%d : beiscsi_dev_probe-"
"Failed to beiscsi_init_irqs\n"); "Failed to beiscsi_init_irqs\n");
goto free_blkenbld; goto disable_iopoll;
} }
hwi_enable_intr(phba); hwi_enable_intr(phba);
ret = iscsi_host_add(phba->shost, &phba->pcidev->dev); ret = iscsi_host_add(phba->shost, &phba->pcidev->dev);
if (ret) if (ret)
goto free_blkenbld; goto free_irqs;
/* set online bit after port is operational */ /* set online bit after port is operational */
set_bit(BEISCSI_HBA_ONLINE, &phba->state); set_bit(BEISCSI_HBA_ONLINE, &phba->state);
...@@ -5724,12 +5734,15 @@ static int beiscsi_dev_probe(struct pci_dev *pcidev, ...@@ -5724,12 +5734,15 @@ static int beiscsi_dev_probe(struct pci_dev *pcidev,
"\n\n\n BM_%d : SUCCESS - DRIVER LOADED\n\n\n"); "\n\n\n BM_%d : SUCCESS - DRIVER LOADED\n\n\n");
return 0; return 0;
free_blkenbld: free_irqs:
destroy_workqueue(phba->wq); hwi_disable_intr(phba);
beiscsi_free_irqs(phba);
disable_iopoll:
for (i = 0; i < phba->num_cpus; i++) { for (i = 0; i < phba->num_cpus; i++) {
pbe_eq = &phwi_context->be_eq[i]; pbe_eq = &phwi_context->be_eq[i];
irq_poll_disable(&pbe_eq->iopoll); irq_poll_disable(&pbe_eq->iopoll);
} }
destroy_workqueue(phba->wq);
free_twq: free_twq:
hwi_cleanup_port(phba); hwi_cleanup_port(phba);
beiscsi_cleanup_port(phba); beiscsi_cleanup_port(phba);
...@@ -5740,7 +5753,7 @@ static int beiscsi_dev_probe(struct pci_dev *pcidev, ...@@ -5740,7 +5753,7 @@ static int beiscsi_dev_probe(struct pci_dev *pcidev,
phba->ctrl.mbox_mem_alloced.va, phba->ctrl.mbox_mem_alloced.va,
phba->ctrl.mbox_mem_alloced.dma); phba->ctrl.mbox_mem_alloced.dma);
beiscsi_unmap_pci_function(phba); beiscsi_unmap_pci_function(phba);
hba_free: free_hba:
pci_disable_msix(phba->pcidev); pci_disable_msix(phba->pcidev);
pci_dev_put(phba->pcidev); pci_dev_put(phba->pcidev);
iscsi_host_free(phba->shost); iscsi_host_free(phba->shost);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment