From: Herbert Xu Date: Sat, 23 May 2015 07:41:48 +0000 (+0800) Subject: crypto: skcipher - Use tmpl->create X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=56e34378bbbb7af21cf73d98a92c0411386e091c;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git crypto: skcipher - Use tmpl->create Newer templates use tmpl->create and have a NULL tmpl->alloc. So we must use tmpl->create if it is set. Signed-off-by: Herbert Xu --- diff --git a/crypto/ablkcipher.c b/crypto/ablkcipher.c index b3dded4558c1..b15d797f94f9 100644 --- a/crypto/ablkcipher.c +++ b/crypto/ablkcipher.c @@ -586,6 +586,13 @@ static int crypto_givcipher_default(struct crypto_alg *alg, u32 type, u32 mask) if (!tmpl) goto kill_larval; + if (tmpl->create) { + err = tmpl->create(tmpl, tb); + if (err) + goto put_tmpl; + goto ok; + } + inst = tmpl->alloc(tb); err = PTR_ERR(inst); if (IS_ERR(inst)) @@ -597,6 +604,7 @@ static int crypto_givcipher_default(struct crypto_alg *alg, u32 type, u32 mask) goto put_tmpl; } +ok: /* Redo the lookup to use the instance we just registered. */ err = -EAGAIN;