[PATCH] mpt fusion: deregister from transport layer if PCI registration failed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The mptspi and mptsas drivers are modified to deregister from transport layer
if registration with PCI driver failed

Signed-Off-by: Sathya Prakash <sathya.prakash@xxxxxxx>

----------------

diff -uarpN b/drivers/message/fusion/mptsas.c a/drivers/message/fusion/mptsas.c
--- b/drivers/message/fusion/mptsas.c	2007-07-02 16:20:46.000000000 +0530
+++ a/drivers/message/fusion/mptsas.c	2007-07-02 16:22:23.000000000 +0530
@@ -3237,6 +3237,8 @@ static struct pci_driver mptsas_driver =
 static int __init
 mptsas_init(void)
 {
+	int error;
+
 	show_mptmod_ver(my_NAME, my_VERSION);
 
 	mptsas_transport_template =
@@ -3259,8 +3261,12 @@ mptsas_init(void)
 		dprintk((KERN_INFO MYNAM
 		  ": Registered for IOC reset notifications\n"));
 	}
+	
+	error = pci_register_driver(&mptsas_driver);
+	if (error)
+		sas_release_transport(mptsas_transport_template);
 
-	return pci_register_driver(&mptsas_driver);
+	return error;
 }
 
 static void __exit
diff -uarpN b/drivers/message/fusion/mptspi.c a/drivers/message/fusion/mptspi.c
--- b/drivers/message/fusion/mptspi.c	2007-07-02 16:20:46.000000000 +0530
+++ a/drivers/message/fusion/mptspi.c	2007-07-02 16:22:23.000000000 +0530
@@ -1521,6 +1521,8 @@ static struct pci_driver mptspi_driver =
 static int __init
 mptspi_init(void)
 {
+	int error;
+
 	show_mptmod_ver(my_NAME, my_VERSION);
 
 	mptspi_transport_template = spi_attach_transport(&mptspi_transport_functions);
@@ -1541,7 +1543,11 @@ mptspi_init(void)
 		  ": Registered for IOC reset notifications\n"));
 	}
 
-	return pci_register_driver(&mptspi_driver);
+	error = pci_register_driver(&mptspi_driver);
+	if (error)
+		spi_release_transport(mptspi_transport_template);
+
+	return error;
 }
 
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux