diff options
author | Fabio Estevam <fabio.estevam@freescale.com> | 2014-01-28 19:36:11 -0500 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2014-02-08 20:59:25 -0500 |
commit | e921f0307531b27dbe34c17e8a5be5a88010d179 (patch) | |
tree | 0bff420242da8ff8da23683c638f7132813b35f7 /drivers/crypto | |
parent | f3de9cb1ca6ce347393c4789b3a6142f96827f18 (diff) |
crypto: mxs-dcp: Use devm_kzalloc()
Using devm_kzalloc() can make the code cleaner.
While at it, remove the devm_kzalloc error message as there is standard OOM
message done by the core.
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Acked-by: Marek Vasut <marex@denx.de>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto')
-rw-r--r-- | drivers/crypto/mxs-dcp.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/drivers/crypto/mxs-dcp.c b/drivers/crypto/mxs-dcp.c index 56bde65ddadf..30941d0c5803 100644 --- a/drivers/crypto/mxs-dcp.c +++ b/drivers/crypto/mxs-dcp.c | |||
@@ -942,9 +942,8 @@ static int mxs_dcp_probe(struct platform_device *pdev) | |||
942 | } | 942 | } |
943 | 943 | ||
944 | /* Allocate coherent helper block. */ | 944 | /* Allocate coherent helper block. */ |
945 | sdcp->coh = kzalloc(sizeof(struct dcp_coherent_block), GFP_KERNEL); | 945 | sdcp->coh = devm_kzalloc(dev, sizeof(*sdcp->coh), GFP_KERNEL); |
946 | if (!sdcp->coh) { | 946 | if (!sdcp->coh) { |
947 | dev_err(dev, "Error allocating coherent block\n"); | ||
948 | ret = -ENOMEM; | 947 | ret = -ENOMEM; |
949 | goto err_mutex; | 948 | goto err_mutex; |
950 | } | 949 | } |
@@ -989,7 +988,7 @@ static int mxs_dcp_probe(struct platform_device *pdev) | |||
989 | if (IS_ERR(sdcp->thread[DCP_CHAN_HASH_SHA])) { | 988 | if (IS_ERR(sdcp->thread[DCP_CHAN_HASH_SHA])) { |
990 | dev_err(dev, "Error starting SHA thread!\n"); | 989 | dev_err(dev, "Error starting SHA thread!\n"); |
991 | ret = PTR_ERR(sdcp->thread[DCP_CHAN_HASH_SHA]); | 990 | ret = PTR_ERR(sdcp->thread[DCP_CHAN_HASH_SHA]); |
992 | goto err_free_coherent; | 991 | goto err_mutex; |
993 | } | 992 | } |
994 | 993 | ||
995 | sdcp->thread[DCP_CHAN_CRYPTO] = kthread_run(dcp_chan_thread_aes, | 994 | sdcp->thread[DCP_CHAN_CRYPTO] = kthread_run(dcp_chan_thread_aes, |
@@ -1047,8 +1046,6 @@ err_destroy_aes_thread: | |||
1047 | err_destroy_sha_thread: | 1046 | err_destroy_sha_thread: |
1048 | kthread_stop(sdcp->thread[DCP_CHAN_HASH_SHA]); | 1047 | kthread_stop(sdcp->thread[DCP_CHAN_HASH_SHA]); |
1049 | 1048 | ||
1050 | err_free_coherent: | ||
1051 | kfree(sdcp->coh); | ||
1052 | err_mutex: | 1049 | err_mutex: |
1053 | mutex_unlock(&global_mutex); | 1050 | mutex_unlock(&global_mutex); |
1054 | return ret; | 1051 | return ret; |
@@ -1058,8 +1055,6 @@ static int mxs_dcp_remove(struct platform_device *pdev) | |||
1058 | { | 1055 | { |
1059 | struct dcp *sdcp = platform_get_drvdata(pdev); | 1056 | struct dcp *sdcp = platform_get_drvdata(pdev); |
1060 | 1057 | ||
1061 | kfree(sdcp->coh); | ||
1062 | |||
1063 | if (sdcp->caps & MXS_DCP_CAPABILITY1_SHA256) | 1058 | if (sdcp->caps & MXS_DCP_CAPABILITY1_SHA256) |
1064 | crypto_unregister_ahash(&dcp_sha256_alg); | 1059 | crypto_unregister_ahash(&dcp_sha256_alg); |
1065 | 1060 | ||