[PATCH 2/5] pmcraid: fix pmcraid_netlink_init() error path in module_init

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

 



pmcraid_netlink_init() error path in module_init doesn't destroy
a struct class that was created just before.

Signed-off-by: Akinobu Mita <akinobu.mita@xxxxxxxxx>
Cc: Anil Ravindranath <anil_ravindranath@xxxxxxxxxxxxxx>
Cc: "James E.J. Bottomley" <JBottomley@xxxxxxxxxxxxx>
Cc: linux-scsi@xxxxxxxxxxxxxxx
---
 drivers/scsi/pmcraid.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
index 073ff48..db77bf9 100644
--- a/drivers/scsi/pmcraid.c
+++ b/drivers/scsi/pmcraid.c
@@ -6114,18 +6114,20 @@ static int __init pmcraid_init(void)
 	error = pmcraid_netlink_init();
 
 	if (error)
-		goto out_unreg_chrdev;
+		goto out_class_destroy;
 
 	error = pci_register_driver(&pmcraid_driver);
 
-	if (error == 0)
-		goto out_init;
+	if (error)
+		goto out_netlink_release;
 
-	pmcraid_err("failed to register pmcraid driver, error = %x\n",
-		     error);
-	class_destroy(pmcraid_class);
-	pmcraid_netlink_release();
+	return 0;
 
+out_netlink_release:
+	pmcraid_err("failed to register pmcraid driver, error = %x\n", error);
+	pmcraid_netlink_release();
+out_class_destroy:
+	class_destroy(pmcraid_class);
 out_unreg_chrdev:
 	unregister_chrdev_region(MKDEV(pmcraid_major, 0), PMCRAID_MAX_ADAPTERS);
 
-- 
1.8.1

--
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