]> www.infradead.org Git - users/hch/block.git/commitdiff
loop: return void from the ->release method in loop_func_table
authorChristoph Hellwig <hch@lst.de>
Tue, 17 Aug 2021 12:49:52 +0000 (14:49 +0200)
committerChristoph Hellwig <hch@lst.de>
Thu, 26 Aug 2021 09:43:35 +0000 (11:43 +0200)
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@lst.de>
drivers/block/cryptoloop.c
drivers/block/loop.c
drivers/block/loop.h

index 2c705ea7f2184bff26adcea8d33cd1de08634ebd..c2392ce2a8192f4a4c0269248980818925b787c0 100644 (file)
@@ -153,17 +153,11 @@ out:
        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 = {
index 508a168fddaafbdf3631d7831c24d7b1cab2993f..68097460116155e9389c9cc785ab15e625b0c2d0 100644 (file)
@@ -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;
index dcde46afc67575963d123fb5aeefc0e9e8ef1d77..7b84ef724de1e4f3085d5106c070e0b9d291f74a 100644 (file)
@@ -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;
 };