[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210823202930.137278-9-mcgrof@kernel.org>
Date: Mon, 23 Aug 2021 13:29:28 -0700
From: Luis Chamberlain <mcgrof@...nel.org>
To: axboe@...nel.dk, martin.petersen@...cle.com, jejb@...ux.ibm.com,
kbusch@...nel.org, sagi@...mberg.me, adrian.hunter@...el.com,
beanhuo@...ron.com, ulf.hansson@...aro.org, avri.altman@....com,
swboyd@...omium.org, agk@...hat.com, snitzer@...hat.com,
josef@...icpanda.com
Cc: hch@...radead.org, hare@...e.de, bvanassche@....org,
ming.lei@...hat.com, linux-scsi@...r.kernel.org,
linux-nvme@...ts.infradead.org, linux-mmc@...r.kernel.org,
dm-devel@...hat.com, nbd@...er.debian.org,
linux-block@...r.kernel.org, linux-kernel@...r.kernel.org,
Luis Chamberlain <mcgrof@...nel.org>
Subject: [PATCH 08/10] dm: add add_disk() error handling
We never checked for errors on add_disk() as this function
returned void. Now that this is fixed, use the shiny new
error handling.
Signed-off-by: Luis Chamberlain <mcgrof@...nel.org>
---
drivers/md/dm.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 7981b7287628..cd26fde4ab56 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -2077,15 +2077,21 @@ int dm_setup_md_queue(struct mapped_device *md, struct dm_table *t)
if (r)
return r;
- add_disk(md->disk);
+ r = add_disk(md->disk);
+ if (r)
+ goto out_cleanup_disk;
r = dm_sysfs_init(md);
- if (r) {
- del_gendisk(md->disk);
- return r;
- }
+ if (r)
+ goto out_del_gendisk;
md->type = type;
return 0;
+
+out_cleanup_disk:
+ blk_cleanup_disk(md->disk);
+out_del_gendisk:
+ del_gendisk(md->disk);
+ return r;
}
struct mapped_device *dm_get_md(dev_t dev)
--
2.30.2
Powered by blists - more mailing lists