crypto: atmel - Check for clk_prepare_enable() return value
authorLABBE Corentin <clabbe.montjoie@gmail.com>
Fri, 2 Oct 2015 12:12:58 +0000 (14:12 +0200)
committerHerbert Xu <herbert@gondor.apana.org.au>
Thu, 8 Oct 2015 13:42:21 +0000 (21:42 +0800)
clk_prepare_enable() can fail so add a check for this and
return the error code if it fails.

Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/atmel-aes.c
drivers/crypto/atmel-sha.c
drivers/crypto/atmel-tdes.c

index 0f9a9dc06a830f4eb5f9669ba26df7c2f0a95077..de8f5da75a0f2be55eade4b614bd89cf85168536 100644 (file)
@@ -260,7 +260,11 @@ static struct atmel_aes_dev *atmel_aes_find_dev(struct atmel_aes_ctx *ctx)
 
 static int atmel_aes_hw_init(struct atmel_aes_dev *dd)
 {
-       clk_prepare_enable(dd->iclk);
+       int err;
+
+       err = clk_prepare_enable(dd->iclk);
+       if (err)
+               return err;
 
        if (!(dd->flags & AES_FLAGS_INIT)) {
                atmel_aes_write(dd, AES_CR, AES_CR_SWRST);
index 5b35433c5399b1264712d6b785cacea6abca5c9b..5e6cf0891b4d9000a19cd2e485c13e5621cfab7b 100644 (file)
@@ -794,7 +794,11 @@ static void atmel_sha_finish_req(struct ahash_request *req, int err)
 
 static int atmel_sha_hw_init(struct atmel_sha_dev *dd)
 {
-       clk_prepare_enable(dd->iclk);
+       int err;
+
+       err = clk_prepare_enable(dd->iclk);
+       if (err)
+               return err;
 
        if (!(SHA_FLAGS_INIT & dd->flags)) {
                atmel_sha_write(dd, SHA_CR, SHA_CR_SWRST);
index ca2999709eb4cf6fa38ca0096a482659a52c1f21..504e90340074eb0bd52942b07a0992ac9b3739a9 100644 (file)
@@ -218,7 +218,11 @@ static struct atmel_tdes_dev *atmel_tdes_find_dev(struct atmel_tdes_ctx *ctx)
 
 static int atmel_tdes_hw_init(struct atmel_tdes_dev *dd)
 {
-       clk_prepare_enable(dd->iclk);
+       int err;
+
+       err = clk_prepare_enable(dd->iclk);
+       if (err)
+               return err;
 
        if (!(dd->flags & TDES_FLAGS_INIT)) {
                atmel_tdes_write(dd, TDES_CR, TDES_CR_SWRST);