[SCSI] mpt fusion: deregister from transport layer if PCI registration failed
authorPrakash, Sathya <sathya.prakash@lsi.com>
Mon, 2 Jul 2007 11:34:10 +0000 (17:04 +0530)
committerJames Bottomley <jejb@mulgrave.localdomain>
Wed, 18 Jul 2007 16:17:18 +0000 (11:17 -0500)
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@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
drivers/message/fusion/mptsas.c
drivers/message/fusion/mptspi.c

index 030bb8389aee90ebb91702e17751395ca926da6a..d5066464051221589bb4dab1f0a6de65f3200a42 100644 (file)
@@ -3301,6 +3301,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 =
@@ -3324,7 +3326,11 @@ mptsas_init(void)
                  ": Registered for IOC reset notifications\n"));
        }
 
-       return pci_register_driver(&mptsas_driver);
+       error = pci_register_driver(&mptsas_driver);
+       if (error)
+               sas_release_transport(mptsas_transport_template);
+
+       return error;
 }
 
 static void __exit
index 4d2c98104aeb7a3d756c901b6163a3bc3eaa9744..947fe29018002703b4b9dac91b6c2ef416fbbb9a 100644 (file)
@@ -1524,6 +1524,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);
@@ -1544,7 +1546,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;
 }
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/