[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211015233028.2167651-10-mcgrof@kernel.org>
Date: Fri, 15 Oct 2021 16:30:28 -0700
From: Luis Chamberlain <mcgrof@...nel.org>
To: axboe@...nel.dk, jejb@...ux.ibm.com, martin.petersen@...cle.com,
agk@...hat.com, snitzer@...hat.com, colyli@...e.de,
kent.overstreet@...il.com, boris.ostrovsky@...cle.com,
jgross@...e.com, sstabellini@...nel.org, roger.pau@...rix.com,
geert@...ux-m68k.org, ulf.hansson@...aro.org, tj@...nel.org,
hare@...e.de, jdike@...toit.com, richard@....at,
anton.ivanov@...bridgegreys.com, johannes.berg@...el.com,
krisman@...labora.com, chris.obbard@...labora.com,
thehajime@...il.com, zhuyifei1999@...il.com, haris.iqbal@...os.com,
jinpu.wang@...os.com, miquel.raynal@...tlin.com, vigneshr@...com,
linux-mtd@...ts.infradead.org
Cc: linux-scsi@...r.kernel.org, dm-devel@...hat.com,
linux-bcache@...r.kernel.org, xen-devel@...ts.xenproject.org,
linux-m68k@...ts.linux-m68k.org, linux-um@...ts.infradead.org,
linux-block@...r.kernel.org, linux-kernel@...r.kernel.org,
Luis Chamberlain <mcgrof@...nel.org>
Subject: [PATCH 9/9] mtd: 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.
Acked-by: Miquel Raynal <miquel.raynal@...tlin.com>
Signed-off-by: Luis Chamberlain <mcgrof@...nel.org>
---
drivers/mtd/mtd_blkdevs.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c
index b8ae1ec14e17..4eaba6f4ec68 100644
--- a/drivers/mtd/mtd_blkdevs.c
+++ b/drivers/mtd/mtd_blkdevs.c
@@ -384,7 +384,9 @@ int add_mtd_blktrans_dev(struct mtd_blktrans_dev *new)
if (new->readonly)
set_disk_ro(gd, 1);
- device_add_disk(&new->mtd->dev, gd, NULL);
+ ret = device_add_disk(&new->mtd->dev, gd, NULL);
+ if (ret)
+ goto out_cleanup_disk;
if (new->disk_attributes) {
ret = sysfs_create_group(&disk_to_dev(gd)->kobj,
@@ -393,6 +395,8 @@ int add_mtd_blktrans_dev(struct mtd_blktrans_dev *new)
}
return 0;
+out_cleanup_disk:
+ blk_cleanup_disk(new->disk);
out_free_tag_set:
blk_mq_free_tag_set(new->tag_set);
out_kfree_tag_set:
--
2.30.2
Powered by blists - more mailing lists