Commit f7c8f992 authored by Geert Uytterhoeven's avatar Geert Uytterhoeven Committed by Herbert Xu

crypto: ccree - use devm_k[mz]alloc() for cipher data

As the lifetime of the cipher data matches the lifetime of the driver,
cipher data can be allocated using the managed allocators.
Signed-off-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent ff4d719a
...@@ -1626,7 +1626,7 @@ static struct cc_crypto_alg *cc_create_alg(const struct cc_alg_template *tmpl, ...@@ -1626,7 +1626,7 @@ static struct cc_crypto_alg *cc_create_alg(const struct cc_alg_template *tmpl,
struct cc_crypto_alg *t_alg; struct cc_crypto_alg *t_alg;
struct skcipher_alg *alg; struct skcipher_alg *alg;
t_alg = kzalloc(sizeof(*t_alg), GFP_KERNEL); t_alg = devm_kzalloc(dev, sizeof(*t_alg), GFP_KERNEL);
if (!t_alg) if (!t_alg)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
...@@ -1662,7 +1662,6 @@ int cc_cipher_free(struct cc_drvdata *drvdata) ...@@ -1662,7 +1662,6 @@ int cc_cipher_free(struct cc_drvdata *drvdata)
list_for_each_entry_safe(t_alg, n, &drvdata->alg_list, entry) { list_for_each_entry_safe(t_alg, n, &drvdata->alg_list, entry) {
crypto_unregister_skcipher(&t_alg->skcipher_alg); crypto_unregister_skcipher(&t_alg->skcipher_alg);
list_del(&t_alg->entry); list_del(&t_alg->entry);
kfree(t_alg);
} }
return 0; return 0;
} }
...@@ -1703,7 +1702,6 @@ int cc_cipher_alloc(struct cc_drvdata *drvdata) ...@@ -1703,7 +1702,6 @@ int cc_cipher_alloc(struct cc_drvdata *drvdata)
if (rc) { if (rc) {
dev_err(dev, "%s alg registration failed\n", dev_err(dev, "%s alg registration failed\n",
t_alg->skcipher_alg.base.cra_driver_name); t_alg->skcipher_alg.base.cra_driver_name);
kfree(t_alg);
goto fail0; goto fail0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment