linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Jens Axboe <axboe@kernel.dk>
Cc: Hillf Danton <hdanton@sina.com>,
	Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>,
	Pavel Tatashin <pasha.tatashin@soleen.com>,
	"Reviewed-by : Tyler Hicks" <tyhicks@linux.microsoft.com>,
	linux-block@vger.kernel.org
Subject: [PATCH 4/8] loop: return void from the ->release method in loop_func_table
Date: Thu, 26 Aug 2021 15:38:06 +0200	[thread overview]
Message-ID: <20210826133810.3700-5-hch@lst.de> (raw)
In-Reply-To: <20210826133810.3700-1-hch@lst.de>

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 | 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


  parent reply	other threads:[~2021-08-26 13:44 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-26 13:38 sort out the lock order in the loop driver v2 Christoph Hellwig
2021-08-26 13:38 ` [PATCH 1/8] cryptoloop: fix a sparse annotation Christoph Hellwig
2021-08-26 13:38 ` [PATCH 2/8] loop: remove the unused idx argument to loop_control_get_free Christoph Hellwig
2021-08-26 13:38 ` [PATCH 3/8] loop: remove the ->ioctl method in loop_func_table Christoph Hellwig
2021-08-26 13:38 ` Christoph Hellwig [this message]
2021-08-26 13:38 ` [PATCH 5/8] loop: merge the cryptoloop module into the main loop module Christoph Hellwig
2021-08-26 16:31   ` Milan Broz
2021-08-26 16:34     ` Christoph Hellwig
2021-08-26 16:44       ` Milan Broz
2021-08-27  6:45         ` Christoph Hellwig
2021-08-27 11:33           ` Tetsuo Handa
2021-08-27 15:38             ` Christoph Hellwig
2021-08-26 13:38 ` [PATCH 6/8] loop: devirtualize transfer transformations Christoph Hellwig
2021-08-26 13:38 ` [PATCH 7/8] loop: move loop device deletion out of loop_ctl_mutex Christoph Hellwig
2021-08-26 13:38 ` [PATCH 8/8] loop: avoid holding loop_ctl_mutex over add_disk Christoph Hellwig
2021-08-27  0:30 ` sort out the lock order in the loop driver v2 Tetsuo Handa
2021-08-27  6:40   ` Christoph Hellwig
2021-08-27  7:46     ` Tetsuo Handa
2021-08-27 15:34       ` Christoph Hellwig
     [not found] ` <20210827130259.2622-1-hdanton@sina.com>
2021-08-27 14:10   ` Tetsuo Handa
     [not found]   ` <20210828035114.2762-1-hdanton@sina.com>
2021-08-28  5:17     ` Tetsuo Handa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210826133810.3700-5-hch@lst.de \
    --to=hch@lst.de \
    --cc=axboe@kernel.dk \
    --cc=hdanton@sina.com \
    --cc=linux-block@vger.kernel.org \
    --cc=pasha.tatashin@soleen.com \
    --cc=penguin-kernel@i-love.sakura.ne.jp \
    --cc=tyhicks@linux.microsoft.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).