Skip to content

Commit

Permalink
crypto: tegra - fix missing unlock on error case
Browse files Browse the repository at this point in the history
Add the missing unlock on the error handling path in function
tegra_aes_get_random() and tegra_aes_rng_reset().

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
  • Loading branch information
Wei Yongjun authored and Herbert Xu committed Oct 24, 2012
1 parent c12ab20 commit 3200da8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions drivers/crypto/tegra-aes.c
Original file line number Diff line number Diff line change
Expand Up @@ -674,8 +674,10 @@ static int tegra_aes_get_random(struct crypto_rng *tfm, u8 *rdata,
mutex_lock(&aes_lock);

ret = clk_prepare_enable(dd->aes_clk);
if (ret)
if (ret) {
mutex_unlock(&aes_lock);
return ret;
}

ctx->dd = dd;
dd->ctx = ctx;
Expand Down Expand Up @@ -759,8 +761,10 @@ static int tegra_aes_rng_reset(struct crypto_rng *tfm, u8 *seed,
dd->flags = FLAGS_ENCRYPT | FLAGS_RNG;

ret = clk_prepare_enable(dd->aes_clk);
if (ret)
if (ret) {
mutex_unlock(&aes_lock);
return ret;
}

aes_set_key(dd);

Expand Down

0 comments on commit 3200da8

Please sign in to comment.