Returning an error here is no useful. So remove the cargo culted check in cryptoloop and remove the return value. Signed-off-by: Christoph Hellwig <hch@xxxxxx> --- drivers/block/cryptoloop.c | 12 +++--------- drivers/block/loop.c | 10 +++------- drivers/block/loop.h | 2 +- 3 files changed, 7 insertions(+), 17 deletions(-) diff --git a/drivers/block/cryptoloop.c b/drivers/block/cryptoloop.c index 2c705ea7f218..c2392ce2a819 100644 --- a/drivers/block/cryptoloop.c +++ b/drivers/block/cryptoloop.c @@ -153,17 +153,11 @@ cryptoloop_transfer(struct loop_device *lo, int cmd, return err; } -static int +static void cryptoloop_release(struct loop_device *lo) { - struct crypto_sync_skcipher *tfm = lo->key_data; - if (tfm != NULL) { - crypto_free_sync_skcipher(tfm); - lo->key_data = NULL; - return 0; - } - printk(KERN_ERR "cryptoloop_release(): tfm == NULL?\n"); - return -EINVAL; + crypto_free_sync_skcipher(lo->key_data); + lo->key_data = NULL; } static struct loop_func_table cryptoloop_funcs = { diff --git a/drivers/block/loop.c b/drivers/block/loop.c index 508a168fddaa..680974601161 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -1084,20 +1084,18 @@ static void loop_update_rotational(struct loop_device *lo) blk_queue_flag_clear(QUEUE_FLAG_NONROT, q); } -static int +static void loop_release_xfer(struct loop_device *lo) { - int err = 0; struct loop_func_table *xfer = lo->lo_encryption; if (xfer) { if (xfer->release) - err = xfer->release(lo); + xfer->release(lo); lo->transfer = NULL; lo->lo_encryption = NULL; module_put(xfer->owner); } - return err; } static int @@ -1140,9 +1138,7 @@ loop_set_status_from_info(struct loop_device *lo, if ((unsigned int) info->lo_encrypt_key_size > LO_KEY_SIZE) return -EINVAL; - err = loop_release_xfer(lo); - if (err) - return err; + loop_release_xfer(lo); if (info->lo_encrypt_type) { unsigned int type = info->lo_encrypt_type; diff --git a/drivers/block/loop.h b/drivers/block/loop.h index dcde46afc675..7b84ef724de1 100644 --- a/drivers/block/loop.h +++ b/drivers/block/loop.h @@ -88,7 +88,7 @@ struct loop_func_table { int size, sector_t real_block); int (*init)(struct loop_device *, const struct loop_info64 *); /* release is called from loop_unregister_transfer or clr_fd */ - int (*release)(struct loop_device *); + void (*release)(struct loop_device *); struct module *owner; }; -- 2.30.2