On Wed, Dec 18, 2019 at 04:07:33PM +0800, Herbert Xu wrote: > This patch introduces the skcipher_ialg_simple helper which fetches > the crypto_alg structure from a simple skcpiher instance's spawn. Typo: skcpiher => skcipher > diff --git a/crypto/ecb.c b/crypto/ecb.c > index 9d6981ca7d5d..249aca75b7dc 100644 > --- a/crypto/ecb.c > +++ b/crypto/ecb.c > @@ -64,10 +64,12 @@ static int crypto_ecb_create(struct crypto_template *tmpl, struct rtattr **tb) > struct crypto_alg *alg; > int err; > > - inst = skcipher_alloc_instance_simple(tmpl, tb, &alg); > + inst = skcipher_alloc_instance_simple(tmpl, tb); > if (IS_ERR(inst)) > return PTR_ERR(inst); > > + alg = skcipher_ialg_simple(inst); > + > inst->alg.ivsize = 0; /* ECB mode doesn't take an IV */ > > inst->alg.encrypt = crypto_ecb_encrypt; > @@ -76,7 +78,7 @@ static int crypto_ecb_create(struct crypto_template *tmpl, struct rtattr **tb) > err = skcipher_register_instance(tmpl, inst); > if (err) > inst->free(inst); > - crypto_mod_put(alg); > + > return err; > } For ecb, 'alg' isn't used anymore, so it should just be removed. > diff --git a/crypto/pcbc.c b/crypto/pcbc.c > index 862cdb8d8b6c..5c5245647208 100644 > --- a/crypto/pcbc.c > +++ b/crypto/pcbc.c > @@ -156,17 +156,19 @@ static int crypto_pcbc_create(struct crypto_template *tmpl, struct rtattr **tb) > struct crypto_alg *alg; > int err; > > - inst = skcipher_alloc_instance_simple(tmpl, tb, &alg); > + inst = skcipher_alloc_instance_simple(tmpl, tb); > if (IS_ERR(inst)) > return PTR_ERR(inst); > > + alg = skcipher_ialg_simple(inst); > + > inst->alg.encrypt = crypto_pcbc_encrypt; > inst->alg.decrypt = crypto_pcbc_decrypt; > > err = skcipher_register_instance(tmpl, inst); > if (err) > inst->free(inst); > - crypto_mod_put(alg); > + > return err; > } Same for pcbc. - Eric