[PATCH v2 02/11] skd: fix error paths in skd_init()
From: Bartlomiej Zolnierkiewicz
Date: Tue Nov 05 2013 - 06:37:41 EST
Cc: Akhil Bhansali <abhansali@xxxxxxxxxxxx>
Cc: Jeff Moyer <jmoyer@xxxxxxxxxx>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@xxxxxxxxxxx>
Signed-off-by: Kyungmin Park <kyungmin.park@xxxxxxxxxxx>
---
drivers/block/skd_main.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/drivers/block/skd_main.c b/drivers/block/skd_main.c
index 6f09bca..8c96d18 100644
--- a/drivers/block/skd_main.c
+++ b/drivers/block/skd_main.c
@@ -5396,7 +5396,7 @@ static void skd_log_skreq(struct skd_device *skdev,
static int __init skd_init(void)
{
- int rc = 0;
+ int rc = -ENOMEM;
pr_info(PFX " v%s-b%s loaded\n", DRV_VERSION, DRV_BUILD_ID);
@@ -5454,11 +5454,21 @@ static int __init skd_init(void)
/* Obtain major device number. */
rc = register_blkdev(0, DRV_NAME);
if (rc < 0)
- return rc;
+ goto err_register_blkdev;
skd_major = rc;
- return pci_register_driver(&skd_driver);
+ rc = pci_register_driver(&skd_driver);
+ if (rc < 0)
+ goto err_pci_register_driver;
+
+ return rc;
+
+err_pci_register_driver:
+ unregister_blkdev(skd_major, DRV_NAME);
+
+err_register_blkdev:
+ return rc;
}
static void __exit skd_exit(void)
--
1.8.2.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/