[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210902174105.2418771-3-mcgrof@kernel.org>
Date: Thu, 2 Sep 2021 10:40:58 -0700
From: Luis Chamberlain <mcgrof@...nel.org>
To: axboe@...nel.dk, gregkh@...uxfoundation.org,
chaitanya.kulkarni@....com, atulgopinathan@...il.com, hare@...e.de,
maximlevitsky@...il.com, oakad@...oo.com, ulf.hansson@...aro.org,
colin.king@...onical.com, shubhankarvk@...il.com,
baijiaju1990@...il.com, trix@...hat.com,
dongsheng.yang@...ystack.cn, ceph-devel@...r.kernel.org,
miquel.raynal@...tlin.com, richard@....at, vigneshr@...com,
sth@...ux.ibm.com, hoeppner@...ux.ibm.com, hca@...ux.ibm.com,
gor@...ux.ibm.com, borntraeger@...ibm.com, oberpar@...ux.ibm.com,
tj@...nel.org
Cc: linux-s390@...r.kernel.org, linux-mtd@...ts.infradead.org,
linux-mmc@...r.kernel.org, linux-block@...r.kernel.org,
linux-kernel@...r.kernel.org, Luis Chamberlain <mcgrof@...nel.org>
Subject: [PATCH 2/9] ms_block: 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.
Contrary to the typical removal which delays the put_disk()
until later, since we are failing on a probe we immediately
put the disk on failure from add_disk by using
blk_cleanup_disk().
Signed-off-by: Luis Chamberlain <mcgrof@...nel.org>
---
drivers/memstick/core/ms_block.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/memstick/core/ms_block.c b/drivers/memstick/core/ms_block.c
index 4a4573fa7b0f..86c626933c1a 100644
--- a/drivers/memstick/core/ms_block.c
+++ b/drivers/memstick/core/ms_block.c
@@ -2156,10 +2156,14 @@ static int msb_init_disk(struct memstick_dev *card)
set_disk_ro(msb->disk, 1);
msb_start(card);
- device_add_disk(&card->dev, msb->disk, NULL);
+ rc = device_add_disk(&card->dev, msb->disk, NULL);
+ if (rc)
+ goto out_cleanup_disk;
dbg("Disk added");
return 0;
+out_cleanup_disk:
+ blk_cleanup_disk(msb->disk);
out_free_tag_set:
blk_mq_free_tag_set(&msb->tag_set);
out_release_id:
--
2.30.2
Powered by blists - more mailing lists