diff mbox series

[RESEND] scsi: megaraid: disable device when probe failed after enabled device

Message ID 1567818450-173315-1-git-send-email-chenxiang66@hisilicon.com (mailing list archive)
State Mainlined
Commit 70054aa39a013fa52eff432f2223b8bd5c0048f8
Headers show
Series [RESEND] scsi: megaraid: disable device when probe failed after enabled device | expand

Commit Message

chenxiang Sept. 7, 2019, 1:07 a.m. UTC
From: Xiang Chen <chenxiang66@hisilicon.com>

For pci device, need to disable device when probe failed after enabled
device.

Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
---
 drivers/scsi/megaraid.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

John Garry Sept. 10, 2019, 8:29 a.m. UTC | #1
On 07/09/2019 02:07, chenxiang wrote:
> From: Xiang Chen <chenxiang66@hisilicon.com>
>
> For pci device, need to disable device when probe failed after enabled
> device.
>
> Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>

Reviewed-by: John Garry <john.garry@huawei.com>

> ---
>  drivers/scsi/megaraid.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
> index 45a6604..ff6d4aa 100644
> --- a/drivers/scsi/megaraid.c
> +++ b/drivers/scsi/megaraid.c
> @@ -4183,11 +4183,11 @@ megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
>  		 */
>  		if (pdev->subsystem_vendor == PCI_VENDOR_ID_COMPAQ &&
>  		    pdev->subsystem_device == 0xC000)
> -		   	return -ENODEV;
> +			goto out_disable_device;
>  		/* Now check the magic signature byte */
>  		pci_read_config_word(pdev, PCI_CONF_AMISIG, &magic);
>  		if (magic != HBA_SIGNATURE_471 && magic != HBA_SIGNATURE)
> -			return -ENODEV;
> +			goto out_disable_device;

It would be nicer if the driver didn't init the return code to -ENODEV 
and we set it explicitly here, but that's a different change.

>  		/* Ok it is probably a megaraid */
>  	}
>
>
Martin K. Petersen Sept. 24, 2019, 2:55 a.m. UTC | #2
> For pci device, need to disable device when probe failed after enabled
> device.

Applied to 5.4/scsi-fixes, thanks!
diff mbox series

Patch

diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
index 45a6604..ff6d4aa 100644
--- a/drivers/scsi/megaraid.c
+++ b/drivers/scsi/megaraid.c
@@ -4183,11 +4183,11 @@  megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
 		 */
 		if (pdev->subsystem_vendor == PCI_VENDOR_ID_COMPAQ &&
 		    pdev->subsystem_device == 0xC000)
-		   	return -ENODEV;
+			goto out_disable_device;
 		/* Now check the magic signature byte */
 		pci_read_config_word(pdev, PCI_CONF_AMISIG, &magic);
 		if (magic != HBA_SIGNATURE_471 && magic != HBA_SIGNATURE)
-			return -ENODEV;
+			goto out_disable_device;
 		/* Ok it is probably a megaraid */
 	}