crypto: img-hash - Handle return value of clk_prepare_enable
authorArvind Yadav <arvind.yadav.cs@gmail.com>
Tue, 16 May 2017 08:27:41 +0000 (13:57 +0530)
committerHerbert Xu <herbert@gondor.apana.org.au>
Tue, 23 May 2017 04:52:03 +0000 (12:52 +0800)
Here, Clock enable can failed. So adding an error check for
clk_prepare_enable.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/img-hash.c

index 9b07f3d88febff92cbd2e44527f513c2b3ec09ac..0c6a917a9ab80eaa4f9771a22126be2909de77ee 100644 (file)
@@ -1088,9 +1088,17 @@ static int img_hash_suspend(struct device *dev)
 static int img_hash_resume(struct device *dev)
 {
        struct img_hash_dev *hdev = dev_get_drvdata(dev);
+       int ret;
 
-       clk_prepare_enable(hdev->hash_clk);
-       clk_prepare_enable(hdev->sys_clk);
+       ret = clk_prepare_enable(hdev->hash_clk);
+       if (ret)
+               return ret;
+
+       ret = clk_prepare_enable(hdev->sys_clk);
+       if (ret) {
+               clk_disable_unprepare(hdev->hash_clk);
+               return ret;
+       }
 
        return 0;
 }