diff options
author | Jitendra Bhivare <jitendra.bhivare@broadcom.com> | 2017-10-10 06:48:13 -0400 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2017-10-11 14:18:29 -0400 |
commit | 45371aa398c6473a722e4a3800d9fea5a53e080f (patch) | |
tree | 04c1aea70ac1928eb8285c686d07d92a1eb00bb9 | |
parent | 8dd998e6e94ed6b94f001f4ed37ca9c9120ee257 (diff) |
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: Jitendra Bhivare <jitendra.bhivare@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-rw-r--r-- | drivers/scsi/be2iscsi/be_main.c | 47 |
1 files changed, 30 insertions, 17 deletions
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c index 56ae0f4a4923..8f7e394ec964 100644 --- a/drivers/scsi/be2iscsi/be_main.c +++ b/drivers/scsi/be2iscsi/be_main.c | |||
@@ -790,6 +790,24 @@ static irqreturn_t be_isr(int irq, void *dev_id) | |||
790 | return IRQ_HANDLED; | 790 | return IRQ_HANDLED; |
791 | } | 791 | } |
792 | 792 | ||
793 | static void beiscsi_free_irqs(struct beiscsi_hba *phba) | ||
794 | { | ||
795 | struct hwi_context_memory *phwi_context; | ||
796 | int i; | ||
797 | |||
798 | if (!phba->pcidev->msix_enabled) { | ||
799 | if (phba->pcidev->irq) | ||
800 | free_irq(phba->pcidev->irq, phba); | ||
801 | return; | ||
802 | } | ||
803 | |||
804 | phwi_context = phba->phwi_ctrlr->phwi_ctxt; | ||
805 | for (i = 0; i <= phba->num_cpus; i++) { | ||
806 | free_irq(pci_irq_vector(phba->pcidev, i), | ||
807 | &phwi_context->be_eq[i]); | ||
808 | kfree(phba->msi_name[i]); | ||
809 | } | ||
810 | } | ||
793 | 811 | ||
794 | static int beiscsi_init_irqs(struct beiscsi_hba *phba) | 812 | static int beiscsi_init_irqs(struct beiscsi_hba *phba) |
795 | { | 813 | { |
@@ -5396,15 +5414,7 @@ static void beiscsi_disable_port(struct beiscsi_hba *phba, int unload) | |||
5396 | phwi_ctrlr = phba->phwi_ctrlr; | 5414 | phwi_ctrlr = phba->phwi_ctrlr; |
5397 | phwi_context = phwi_ctrlr->phwi_ctxt; | 5415 | phwi_context = phwi_ctrlr->phwi_ctxt; |
5398 | hwi_disable_intr(phba); | 5416 | hwi_disable_intr(phba); |
5399 | if (phba->pcidev->msix_enabled) { | 5417 | beiscsi_free_irqs(phba); |
5400 | for (i = 0; i <= phba->num_cpus; i++) { | ||
5401 | free_irq(pci_irq_vector(phba->pcidev, i), | ||
5402 | &phwi_context->be_eq[i]); | ||
5403 | kfree(phba->msi_name[i]); | ||
5404 | } | ||
5405 | } else | ||
5406 | if (phba->pcidev->irq) | ||
5407 | free_irq(phba->pcidev->irq, phba); | ||
5408 | pci_free_irq_vectors(phba->pcidev); | 5418 | pci_free_irq_vectors(phba->pcidev); |
5409 | 5419 | ||
5410 | for (i = 0; i < phba->num_cpus; i++) { | 5420 | for (i = 0; i < phba->num_cpus; i++) { |
@@ -5595,12 +5605,12 @@ static int beiscsi_dev_probe(struct pci_dev *pcidev, | |||
5595 | if (ret) { | 5605 | if (ret) { |
5596 | beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT, | 5606 | beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT, |
5597 | "BM_%d : be_ctrl_init failed\n"); | 5607 | "BM_%d : be_ctrl_init failed\n"); |
5598 | goto hba_free; | 5608 | goto free_hba; |
5599 | } | 5609 | } |
5600 | 5610 | ||
5601 | ret = beiscsi_init_sliport(phba); | 5611 | ret = beiscsi_init_sliport(phba); |
5602 | if (ret) | 5612 | if (ret) |
5603 | goto hba_free; | 5613 | goto free_hba; |
5604 | 5614 | ||
5605 | spin_lock_init(&phba->io_sgl_lock); | 5615 | spin_lock_init(&phba->io_sgl_lock); |
5606 | spin_lock_init(&phba->mgmt_sgl_lock); | 5616 | spin_lock_init(&phba->mgmt_sgl_lock); |
@@ -5680,13 +5690,13 @@ static int beiscsi_dev_probe(struct pci_dev *pcidev, | |||
5680 | beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT, | 5690 | beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT, |
5681 | "BM_%d : beiscsi_dev_probe-" | 5691 | "BM_%d : beiscsi_dev_probe-" |
5682 | "Failed to beiscsi_init_irqs\n"); | 5692 | "Failed to beiscsi_init_irqs\n"); |
5683 | goto free_blkenbld; | 5693 | goto disable_iopoll; |
5684 | } | 5694 | } |
5685 | hwi_enable_intr(phba); | 5695 | hwi_enable_intr(phba); |
5686 | 5696 | ||
5687 | ret = iscsi_host_add(phba->shost, &phba->pcidev->dev); | 5697 | ret = iscsi_host_add(phba->shost, &phba->pcidev->dev); |
5688 | if (ret) | 5698 | if (ret) |
5689 | goto free_blkenbld; | 5699 | goto free_irqs; |
5690 | 5700 | ||
5691 | /* set online bit after port is operational */ | 5701 | /* set online bit after port is operational */ |
5692 | set_bit(BEISCSI_HBA_ONLINE, &phba->state); | 5702 | set_bit(BEISCSI_HBA_ONLINE, &phba->state); |
@@ -5724,12 +5734,15 @@ static int beiscsi_dev_probe(struct pci_dev *pcidev, | |||
5724 | "\n\n\n BM_%d : SUCCESS - DRIVER LOADED\n\n\n"); | 5734 | "\n\n\n BM_%d : SUCCESS - DRIVER LOADED\n\n\n"); |
5725 | return 0; | 5735 | return 0; |
5726 | 5736 | ||
5727 | free_blkenbld: | 5737 | free_irqs: |
5728 | destroy_workqueue(phba->wq); | 5738 | hwi_disable_intr(phba); |
5739 | beiscsi_free_irqs(phba); | ||
5740 | disable_iopoll: | ||
5729 | for (i = 0; i < phba->num_cpus; i++) { | 5741 | for (i = 0; i < phba->num_cpus; i++) { |
5730 | pbe_eq = &phwi_context->be_eq[i]; | 5742 | pbe_eq = &phwi_context->be_eq[i]; |
5731 | irq_poll_disable(&pbe_eq->iopoll); | 5743 | irq_poll_disable(&pbe_eq->iopoll); |
5732 | } | 5744 | } |
5745 | destroy_workqueue(phba->wq); | ||
5733 | free_twq: | 5746 | free_twq: |
5734 | hwi_cleanup_port(phba); | 5747 | hwi_cleanup_port(phba); |
5735 | beiscsi_cleanup_port(phba); | 5748 | beiscsi_cleanup_port(phba); |
@@ -5738,9 +5751,9 @@ free_port: | |||
5738 | pci_free_consistent(phba->pcidev, | 5751 | pci_free_consistent(phba->pcidev, |
5739 | phba->ctrl.mbox_mem_alloced.size, | 5752 | phba->ctrl.mbox_mem_alloced.size, |
5740 | phba->ctrl.mbox_mem_alloced.va, | 5753 | phba->ctrl.mbox_mem_alloced.va, |
5741 | phba->ctrl.mbox_mem_alloced.dma); | 5754 | phba->ctrl.mbox_mem_alloced.dma); |
5742 | beiscsi_unmap_pci_function(phba); | 5755 | beiscsi_unmap_pci_function(phba); |
5743 | hba_free: | 5756 | free_hba: |
5744 | pci_disable_msix(phba->pcidev); | 5757 | pci_disable_msix(phba->pcidev); |
5745 | pci_dev_put(phba->pcidev); | 5758 | pci_dev_put(phba->pcidev); |
5746 | iscsi_host_free(phba->shost); | 5759 | iscsi_host_free(phba->shost); |