crypto: Fix memory leak when clk enabling fails

Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
diff --git a/drivers/crypto/msm/qce.c b/drivers/crypto/msm/qce.c
index b945d24..cec5df4 100644
--- a/drivers/crypto/msm/qce.c
+++ b/drivers/crypto/msm/qce.c
@@ -2219,10 +2219,16 @@
 	pce_dev->pdev = &pdev->dev;
 	ce_clk = clk_get(pce_dev->pdev, "ce_clk");
 	if (IS_ERR(ce_clk)) {
+		kfree(pce_dev);
 		*rc = PTR_ERR(ce_clk);
 		return NULL;
 	}
 	pce_dev->ce_clk = ce_clk;
+	*rc = clk_enable(pce_dev->ce_clk);
+	if (*rc) {
+		kfree(pce_dev);
+		return NULL;
+	}
 
 	resource = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	if (!resource) {
@@ -2296,10 +2302,6 @@
 	pce_dev->chan_ce_in_state = QCE_CHAN_STATE_IDLE;
 	pce_dev->chan_ce_out_state = QCE_CHAN_STATE_IDLE;
 
-	*rc = clk_enable(pce_dev->ce_clk);
-	if (*rc)
-		return NULL;
-
 	if (_init_ce_engine(pce_dev)) {
 		*rc = -ENXIO;
 		clk_disable(pce_dev->ce_clk);
@@ -2603,5 +2605,5 @@
 MODULE_LICENSE("GPL v2");
 MODULE_AUTHOR("Mona Hossain <mhossain@codeaurora.org>");
 MODULE_DESCRIPTION("Crypto Engine driver");
-MODULE_VERSION("1.11");
+MODULE_VERSION("1.12");