On Fri, Dec 06, 2019 at 01:57:04PM +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. > > This allows us to remove the third argument from the function > skcipher_alloc_instance_simple. > > Signed-off-by: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> > > diff --git a/crypto/cbc.c b/crypto/cbc.c > index dd96bcf4d4b6..b9c718fe9d7d 100644 > --- a/crypto/cbc.c > +++ b/crypto/cbc.c > @@ -54,10 +54,12 @@ static int crypto_cbc_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); > + > err = -EINVAL; > if (!is_power_of_2(alg->cra_blocksize)) > goto out_free_inst; This doesn't seem like an improvement, because skcipher_alloc_instance_simple() takes a reference to 'alg' which the caller must drop. It's better to make this explicit by having 'alg' be one of the return values. - Eric