From: weiping zhang Date: Mon, 7 Aug 2017 17:26:57 +0000 (+0800) Subject: scsi: megaraid_sas: fix error handle in megasas_probe_one X-Git-Tag: v4.1.12-124.31.3~1068 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=0c1041084c345523adf0e9f036fba35c75a2c1fe;p=users%2Fjedix%2Flinux-maple.git scsi: megaraid_sas: fix error handle in megasas_probe_one 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 Acked-by: Sumit Saxena Signed-off-by: Martin K. Petersen Orabug: 27625001 Signed-off-by: Jack Vogel Reviewed-by: Martin K. Petersen --- diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index f17c10109778..44b01a206478 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -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);