scsi: megaraid_sas: Fix goto labels in error handling
authorShivasharan S <shivasharan.srikanteshwara@broadcom.com>
Wed, 17 Oct 2018 06:37:44 +0000 (23:37 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 1 Dec 2019 08:14:10 +0000 (09:14 +0100)
[ Upstream commit 8a25fa17b6ed6e6c8101e9c68a10ae68a9025f2c ]

During init, if pci_alloc_irq_vectors() fails, the driver has not yet setup
the IRQs. Fix the goto labels and error handling for this case.

Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/scsi/megaraid/megaraid_sas_base.c

index 23a9f0777fa62230eed1bff9aee565e17cd80ccb..577513649afbe9c424a3aa1547ddbbb0e5abc1fa 100644 (file)
@@ -5324,7 +5324,7 @@ static int megasas_init_fw(struct megasas_instance *instance)
        if (!instance->msix_vectors) {
                i = pci_alloc_irq_vectors(instance->pdev, 1, 1, PCI_IRQ_LEGACY);
                if (i < 0)
-                       goto fail_setup_irqs;
+                       goto fail_init_adapter;
        }
 
        megasas_setup_reply_map(instance);
@@ -5541,9 +5541,8 @@ static int megasas_init_fw(struct megasas_instance *instance)
 
 fail_get_ld_pd_list:
        instance->instancet->disable_intr(instance);
-fail_init_adapter:
        megasas_destroy_irqs(instance);
-fail_setup_irqs:
+fail_init_adapter:
        if (instance->msix_vectors)
                pci_free_irq_vectors(instance->pdev);
        instance->msix_vectors = 0;