]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
scsi: megaraid_sas: fix error handle in megasas_probe_one
authorweiping zhang <zhangweiping@didichuxing.com>
Mon, 7 Aug 2017 17:26:57 +0000 (01:26 +0800)
committerJack Vogel <jack.vogel@oracle.com>
Thu, 8 Mar 2018 02:44:04 +0000 (18:44 -0800)
megasas_mgmt_info.max_index has increased by 1 before megasas_io_attach,
if megasas_io_attach return error, then goto fail_io_attach,
megasas_mgmt_info.instance has a wrong index here. So first reduce
max_index and then set that instance to NULL.

Signed-off-by: weiping zhang <zhangweiping@didichuxing.com>
Acked-by: Sumit Saxena <sumit.saxena@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Orabug: 27625001
Signed-off-by: Jack Vogel <jack.vogel@oracle.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/megaraid/megaraid_sas_base.c

index f17c101097788a38afd94cb8ee334f241e9ef90d..44b01a206478474482161b4c7eb4a806200d9fef 100644 (file)
@@ -6255,8 +6255,8 @@ static int megasas_probe_one(struct pci_dev *pdev,
 fail_start_aen:
 fail_io_attach:
        megasas_mgmt_info.count--;
-       megasas_mgmt_info.instance[megasas_mgmt_info.max_index] = NULL;
        megasas_mgmt_info.max_index--;
+       megasas_mgmt_info.instance[megasas_mgmt_info.max_index] = NULL;
 
        instance->instancet->disable_intr(instance);
        megasas_destroy_irqs(instance);