public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Heiko Carstens <heiko.carstens@de.ibm.com>
To: James Bottomley <James.Bottomley@SteelEye.com>,
	SCSI Mailing List <linux-scsi@vger.kernel.org>
Subject: [PATCH] fix module_init functions of transport classes
Date: Tue, 11 Jan 2005 09:30:44 +0100	[thread overview]
Message-ID: <20050111083044.GA3239@osiris.boeblingen.de.ibm.com> (raw)

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)

                 reply	other threads:[~2005-01-11  8:31 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050111083044.GA3239@osiris.boeblingen.de.ibm.com \
    --to=heiko.carstens@de.ibm.com \
    --cc=James.Bottomley@SteelEye.com \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox