[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211015235219.2191207-10-mcgrof@kernel.org>
Date: Fri, 15 Oct 2021 16:52:15 -0700
From: Luis Chamberlain <mcgrof@...nel.org>
To: axboe@...nel.dk, geoff@...radead.org, mpe@...erman.id.au,
benh@...nel.crashing.org, paulus@...ba.org, jim@...n.com,
minchan@...nel.org, ngupta@...are.org, senozhatsky@...omium.org,
richard@....at, miquel.raynal@...tlin.com, vigneshr@...com,
dan.j.williams@...el.com, vishal.l.verma@...el.com,
dave.jiang@...el.com, ira.weiny@...el.com, kbusch@...nel.org,
hch@....de, sagi@...mberg.me
Cc: linux-block@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org,
linux-mtd@...ts.infradead.org, nvdimm@...ts.linux.dev,
linux-nvme@...ts.infradead.org, linux-kernel@...r.kernel.org,
Luis Chamberlain <mcgrof@...nel.org>
Subject: [PATCH 09/13] z2ram: add error handling support for add_disk()
We never checked for errors on add_disk() as this function
returned void. Now that this is fixed, use the shiny new
error handling. Only the disk is cleaned up inside
z2ram_register_disk() as the caller deals with the rest.
Signed-off-by: Luis Chamberlain <mcgrof@...nel.org>
---
drivers/block/z2ram.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/block/z2ram.c b/drivers/block/z2ram.c
index 4eef218108c6..ccc52c935faf 100644
--- a/drivers/block/z2ram.c
+++ b/drivers/block/z2ram.c
@@ -318,6 +318,7 @@ static const struct blk_mq_ops z2_mq_ops = {
static int z2ram_register_disk(int minor)
{
struct gendisk *disk;
+ int err;
disk = blk_mq_alloc_disk(&tag_set, NULL);
if (IS_ERR(disk))
@@ -333,8 +334,10 @@ static int z2ram_register_disk(int minor)
sprintf(disk->disk_name, "z2ram");
z2ram_gendisk[minor] = disk;
- add_disk(disk);
- return 0;
+ err = add_disk(disk);
+ if (err)
+ blk_cleanup_disk(disk);
+ return err;
}
static int __init z2_init(void)
--
2.30.2
Powered by blists - more mailing lists