public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fix module_init functions of transport classes
@ 2005-01-11  8:30 Heiko Carstens
  0 siblings, 0 replies; only message in thread
From: Heiko Carstens @ 2005-01-11  8:30 UTC (permalink / raw)
  To: James Bottomley, SCSI Mailing List

Hi James,

thanks for explaining the object lifetimes rules in the SCSI stack to
me. Unfortunately I don't think I could exploit that to solve the zfcp
problem.

While looking at the FC transport class code I think there is a minor
bug if class_register fails in the module_init code. The
class_unregister call of the succeeded class_register call seems to be
missing. Patch below is untested.

Heiko

===== scsi_transport_fc.c 1.11 vs edited =====
--- 1.11/drivers/scsi/scsi_transport_fc.c	2004-12-27 17:04:13 +01:00
+++ edited/scsi_transport_fc.c	2005-01-11 09:14:03 +01:00
@@ -222,7 +222,10 @@
 	int error = class_register(&fc_host_class);
 	if (error)
 		return error;
-	return class_register(&fc_transport_class);
+	error = class_register(&fc_transport_class);
+	if (error)
+		class_unregister(&fc_host_class);
+	return error;
 }
 
 static void __exit fc_transport_exit(void)
===== scsi_transport_spi.c 1.21 vs edited =====
--- 1.21/drivers/scsi/scsi_transport_spi.c	2004-12-06 21:51:40 +01:00
+++ edited/scsi_transport_spi.c	2005-01-11 09:14:58 +01:00
@@ -134,7 +134,10 @@
 	int error = class_register(&spi_host_class);
 	if (error)
 		return error;
-	return class_register(&spi_transport_class);
+	error = class_register(&spi_transport_class);
+	if (error)
+		class_unregister(&spi_host_class);
+	return error;
 }
 
 static void __exit spi_transport_exit(void)
===== scsi_transport_iscsi.c 1.1 vs edited =====
--- 1.1/drivers/scsi/scsi_transport_iscsi.c	2004-10-29 13:30:20 +02:00
+++ edited/scsi_transport_iscsi.c	2005-01-11 09:28:10 +01:00
@@ -338,7 +338,10 @@
 
 	if (err)
 		return err;
-	return class_register(&iscsi_host_class);
+	err = class_register(&iscsi_host_class);
+	if (err)
+		class_unregister(&iscsi_transport_class);
+	return err;
 }
 
 static void __exit iscsi_transport_exit(void)

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

only message in thread, other threads:[~2005-01-11  8:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-11  8:30 [PATCH] fix module_init functions of transport classes Heiko Carstens

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox