All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] aic94xx: don't return zero on failure paths in aic94xx_init()
@ 2018-05-18 21:27 Alexey Khoroshilov
  0 siblings, 0 replies; only message in thread
From: Alexey Khoroshilov @ 2018-05-18 21:27 UTC (permalink / raw)
  To: James E.J. Bottomley, Martin K. Petersen
  Cc: Alexey Khoroshilov, linux-scsi, linux-kernel, ldv-project,
	Peter Melnichenko

If sas_domain_attach_transport() fails in aic94xx_init(),
it breaks off initialization, deallocates all resources, but returns zero.

The patch adds -ENOMEM as return value in this case.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Peter Melnichenko <melnichenko@ispras.ru>
Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
---
 drivers/scsi/aic94xx/aic94xx_init.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/aic94xx/aic94xx_init.c b/drivers/scsi/aic94xx/aic94xx_init.c
index 6c838865ac5a..4a4746cc6745 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)
-- 
2.7.4

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-05-18 21:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-18 21:27 [PATCH] aic94xx: don't return zero on failure paths in aic94xx_init() Alexey Khoroshilov

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.