[SCSI] megaraid_sas: Fix failure gotos
authoradam radford <aradford@gmail.com>
Fri, 25 Feb 2011 04:55:56 +0000 (20:55 -0800)
committerJames Bottomley <James.Bottomley@suse.de>
Mon, 28 Feb 2011 17:42:36 +0000 (11:42 -0600)
Signed-off-by: Adam Radford <aradford@gmail.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
drivers/scsi/megaraid/megaraid_sas_base.c
drivers/scsi/megaraid/megaraid_sas_fusion.c

index b71caa3f44ea86f697384be05fad828d66025110..c4ac4a5a075a0d9a44f50b6e589861062eda2dd6 100644 (file)
@@ -3424,7 +3424,6 @@ fail_reply_queue:
        megasas_free_cmds(instance);
 
 fail_alloc_cmds:
-       iounmap(instance->reg_set);
        return 1;
 }
 
@@ -3494,7 +3493,7 @@ static int megasas_init_fw(struct megasas_instance *instance)
 
        /* Get operational params, sge flags, send init cmd to controller */
        if (instance->instancet->init_adapter(instance))
-               return -ENODEV;
+               goto fail_init_adapter;
 
        printk(KERN_ERR "megasas: INIT adapter done\n");
 
@@ -3553,6 +3552,7 @@ static int megasas_init_fw(struct megasas_instance *instance)
                                MEGASAS_COMPLETION_TIMER_INTERVAL);
        return 0;
 
+fail_init_adapter:
 fail_ready_state:
        iounmap(instance->reg_set);
 
@@ -4105,10 +4105,13 @@ megasas_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
        instance->instancet->disable_intr(instance->reg_set);
        free_irq(instance->msi_flag ? instance->msixentry.vector :
                 instance->pdev->irq, instance);
+fail_irq:
        if (instance->msi_flag)
                pci_disable_msix(instance->pdev);
-
-      fail_irq:
+       if (instance->pdev->device == PCI_DEVICE_ID_LSI_FUSION)
+               megasas_release_fusion(instance);
+       else
+               megasas_release_mfi(instance);
       fail_init_mfi:
       fail_alloc_dma_buf:
        if (instance->evt_detail)
@@ -4116,13 +4119,9 @@ megasas_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
                                    instance->evt_detail,
                                    instance->evt_detail_h);
 
-       if (instance->producer) {
+       if (instance->producer)
                pci_free_consistent(pdev, sizeof(u32), instance->producer,
                                    instance->producer_h);
-               megasas_release_mfi(instance);
-       } else {
-               megasas_release_fusion(instance);
-       }
        if (instance->consumer)
                pci_free_consistent(pdev, sizeof(u32), instance->consumer,
                                    instance->consumer_h);
index c1e09d5a6196a46552b164585407365aba4e486a..26865290c22a7bb3ac49d6bb42b6fadef1d2e42d 100644 (file)
@@ -984,13 +984,15 @@ megasas_init_adapter_fusion(struct megasas_instance *instance)
 
        return 0;
 
-fail_alloc_cmds:
-fail_alloc_mfi_cmds:
 fail_map_info:
        if (i == 1)
                dma_free_coherent(&instance->pdev->dev, fusion->map_sz,
                                  fusion->ld_map[0], fusion->ld_map_phys[0]);
 fail_ioc_init:
+       megasas_free_cmds_fusion(instance);
+fail_alloc_cmds:
+       megasas_free_cmds(instance);
+fail_alloc_mfi_cmds:
        return 1;
 }