Re: [PATCH] no more need to check for NULL before calls to crypto_free_tfm

From: Jesper Juhl
Date: Mon Jul 18 2005 - 19:14:00 EST


On 7/18/05, Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> wrote:
> On Sun, Jul 17, 2005 at 12:32:27AM +0200, Jesper Juhl wrote:
> >
> > --- linux-2.6.13-rc3-orig/drivers/block/cryptoloop.c 2005-06-17 21:48:29.000000000 +0200
> > +++ linux-2.6.13-rc3/drivers/block/cryptoloop.c 2005-07-16 23:35:55.000000000 +0200
> > @@ -227,14 +227,14 @@ cryptoloop_ioctl(struct loop_device *lo,
> > static int
> > cryptoloop_release(struct loop_device *lo)
> > {
> > - struct crypto_tfm *tfm = (struct crypto_tfm *) lo->key_data;
> > - if (tfm != NULL) {
> > - crypto_free_tfm(tfm);
> > - lo->key_data = NULL;
> > - return 0;
> > + struct crypto_tfm *tfm = lo->key_data;
> > + if (!tfm) {
> > + printk(KERN_ERR "cryptoloop_release(): tfm == NULL?\n");
> > + return -EINVAL;
> > }
> > - printk(KERN_ERR "cryptoloop_release(): tfm == NULL?\n");
> > - return -EINVAL;
> > + crypto_free_tfm(tfm);
> > + lo->key_data = NULL;
> > + return 0;
> > }
>
> This change looks rather pointless.
>
Hmm, I guess you're right. Dunno why I reordered that, but you are
right, it's pretty pointless. Except for getting rid of the cast, that
makes sense, it's superfluous so it should go away...

> The rest of the patch looks good.
>
> Thanks,

You're welcome. Thank you for reviewing it.


--
Jesper Juhl <jesper.juhl@xxxxxxxxx>
Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please http://www.expita.com/nomime.html
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/