All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi: aic94xx: fix an error code in aic94xx_init()
@ 2018-08-08 11:56 Dan Carpenter
  2018-08-08 13:52 ` Johannes Thumshirn
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Dan Carpenter @ 2018-08-08 11:56 UTC (permalink / raw)
  To: kernel-janitors

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

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

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 = -ENODEV;
 		goto out_destroy_caches;
+	}
 
 	err = pci_register_driver(&aic94xx_pci_driver);
 	if (err)

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] scsi: aic94xx: fix an error code in aic94xx_init()
  2018-08-08 11:56 [PATCH] scsi: aic94xx: fix an error code in aic94xx_init() Dan Carpenter
@ 2018-08-08 13:52 ` Johannes Thumshirn
  2018-08-08 14:16 ` John Garry
  2018-08-08 14:25 ` Dan Carpenter
  2 siblings, 0 replies; 4+ messages in thread
From: Johannes Thumshirn @ 2018-08-08 13:52 UTC (permalink / raw)
  To: kernel-janitors

Looks good,
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
-- 
Johannes Thumshirn                                          Storage
jthumshirn@suse.de                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] scsi: aic94xx: fix an error code in aic94xx_init()
  2018-08-08 11:56 [PATCH] scsi: aic94xx: fix an error code in aic94xx_init() Dan Carpenter
  2018-08-08 13:52 ` Johannes Thumshirn
@ 2018-08-08 14:16 ` John Garry
  2018-08-08 14:25 ` Dan Carpenter
  2 siblings, 0 replies; 4+ messages in thread
From: John Garry @ 2018-08-08 14:16 UTC (permalink / raw)
  To: kernel-janitors

On 08/08/2018 12:56, Dan Carpenter wrote:
> We accidentally return success instead of -ENODEV on this error path.

Sorry to nitpick, but - as I see - the only way for 
sas_domain_attach_transport() to fail is if the kzalloc() in 
sas_attach_transport() fails, so should this be -ENOMEM? Other drivers 
return this error code for this scenario.

Thanks,
John

>
> Fixes: 2908d778ab3e ("[SCSI] aic94xx: new driver")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> 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 = -ENODEV;
>  		goto out_destroy_caches;
> +	}
>
>  	err = pci_register_driver(&aic94xx_pci_driver);
>  	if (err)
>
>



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] scsi: aic94xx: fix an error code in aic94xx_init()
  2018-08-08 11:56 [PATCH] scsi: aic94xx: fix an error code in aic94xx_init() Dan Carpenter
  2018-08-08 13:52 ` Johannes Thumshirn
  2018-08-08 14:16 ` John Garry
@ 2018-08-08 14:25 ` Dan Carpenter
  2 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2018-08-08 14:25 UTC (permalink / raw)
  To: kernel-janitors

On Wed, Aug 08, 2018 at 03:16:57PM +0100, John Garry wrote:
> On 08/08/2018 12:56, Dan Carpenter wrote:
> > We accidentally return success instead of -ENODEV on this error path.
> 
> Sorry to nitpick, but - as I see - the only way for
> sas_domain_attach_transport() to fail is if the kzalloc() in
> sas_attach_transport() fails, so should this be -ENOMEM? Other drivers
> return this error code for this scenario.
> 

Huh...  I was so sure I looked up other callers to see what people
normally return...  Anyway, you're right.  Let me resend.

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-08-08 14:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-08 11:56 [PATCH] scsi: aic94xx: fix an error code in aic94xx_init() Dan Carpenter
2018-08-08 13:52 ` Johannes Thumshirn
2018-08-08 14:16 ` John Garry
2018-08-08 14:25 ` Dan Carpenter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.