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.m...@gmail.com>
Cc: Anil Ravindranath <anil_ravindran...@pmc-sierra.com>
Cc: "James E.J. Bottomley" <jbottom...@parallels.com>
Cc: linux-scsi@vger.kernel.org
---
 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 majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to