diff mbox series

[v2] scsi: aic94xx: fix an error code in aic94xx_init()

Message ID 20180808142909.lzdbwxxqt5gwzrzl@kili.mountain (mailing list archive)
State Accepted
Headers show
Series [v2] scsi: aic94xx: fix an error code in aic94xx_init() | expand

Commit Message

Dan Carpenter Aug. 8, 2018, 2:29 p.m. UTC
We accidentally return success instead of -ENOMEM on this error path.

Fixes: 2908d778ab3e ("[SCSI] aic94xx: new driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
v2: return -ENOMEM instead of -ENODEV

Comments

John Garry Aug. 8, 2018, 4:07 p.m. UTC | #1
On 08/08/2018 15:29, Dan Carpenter wrote:
> We accidentally return success instead of -ENOMEM on this error path.
>
> Fixes: 2908d778ab3e ("[SCSI] aic94xx: new driver")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

thanks

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

> ---
> v2: return -ENOMEM instead of -ENODEV
>
> diff --git a/drivers/scsi/aic94xx/aic94xx_init.c b/drivers/scsi/aic94xx/aic94xx_init.c
> index 80e5b283fd81..cb8191afc1dc 100644
> --- a/drivers/scsi/aic94xx/aic94xx_init.c
> +++ b/drivers/scsi/aic94xx/aic94xx_init.c
> @@ -1030,8 +1030,10 @@ static int __init aic94xx_init(void)
>
>  	aic94xx_transport_template =
>  		sas_domain_attach_transport(&aic94xx_transport_functions);
> -	if (!aic94xx_transport_template)
> +	if (!aic94xx_transport_template) {
> +		err = -ENOMEM;
>  		goto out_destroy_caches;
> +	}
>
>  	err = pci_register_driver(&aic94xx_pci_driver);
>  	if (err)
>
> .
>
Martin K. Petersen Aug. 9, 2018, 1:18 a.m. UTC | #2
Dan,

> We accidentally return success instead of -ENOMEM on this error path.

Applied to 4.19/scsi-queue, thanks!
diff mbox series

Patch

diff --git a/drivers/scsi/aic94xx/aic94xx_init.c b/drivers/scsi/aic94xx/aic94xx_init.c
index 80e5b283fd81..cb8191afc1dc 100644
--- a/drivers/scsi/aic94xx/aic94xx_init.c
+++ b/drivers/scsi/aic94xx/aic94xx_init.c
@@ -1030,8 +1030,10 @@  static int __init aic94xx_init(void)
 
 	aic94xx_transport_template =
 		sas_domain_attach_transport(&aic94xx_transport_functions);
-	if (!aic94xx_transport_template)
+	if (!aic94xx_transport_template) {
+		err = -ENOMEM;
 		goto out_destroy_caches;
+	}
 
 	err = pci_register_driver(&aic94xx_pci_driver);
 	if (err)