From: Herbert Xu Date: Sat, 23 May 2015 07:41:49 +0000 (+0800) Subject: crypto: aead - Use tmpl->create X-Git-Tag: v5.15~15621^2~147 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=72af865d3413c319226b6ef5f6956b7f84980a4c;p=platform%2Fkernel%2Flinux-starfive.git crypto: aead - 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/aead.c b/crypto/aead.c index c1f73a9..a6385bd 100644 --- a/crypto/aead.c +++ b/crypto/aead.c @@ -572,6 +572,13 @@ static int crypto_nivaead_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)) @@ -583,6 +590,7 @@ static int crypto_nivaead_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;