From: Luis Chamberlain <mcgrof@kernel.org>
To: axboe@kernel.dk, bhelgaas@google.com, liushixin2@huawei.com,
thunder.leizhen@huawei.com, lee.jones@linaro.org,
geoff@infradead.org, mpe@ellerman.id.au,
benh@kernel.crashing.org, paulus@samba.org, jim@jtan.com,
haris.iqbal@ionos.com, jinpu.wang@ionos.com,
josh.h.morris@us.ibm.com, pjk1939@linux.ibm.com,
tim@cyberelk.net, richard@nod.at, miquel.raynal@bootlin.com,
vigneshr@ti.com
Cc: linux-mtd@lists.infradead.org, linuxppc-dev@lists.ozlabs.org,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
Luis Chamberlain <mcgrof@kernel.org>
Subject: [PATCH v2 10/10] mtd/ubi/block: add error handling support for add_disk()
Date: Mon, 27 Sep 2021 15:01:57 -0700 [thread overview]
Message-ID: <20210927220157.1069658-11-mcgrof@kernel.org> (raw)
In-Reply-To: <20210927220157.1069658-1-mcgrof@kernel.org>
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@kernel.org>
---
drivers/mtd/ubi/block.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/mtd/ubi/block.c b/drivers/mtd/ubi/block.c
index e003b4b44ffa..062e6c2c45f5 100644
--- a/drivers/mtd/ubi/block.c
+++ b/drivers/mtd/ubi/block.c
@@ -447,12 +447,18 @@ int ubiblock_create(struct ubi_volume_info *vi)
list_add_tail(&dev->list, &ubiblock_devices);
/* Must be the last step: anyone can call file ops from now on */
- add_disk(dev->gd);
+ ret = add_disk(dev->gd);
+ if (ret)
+ goto out_destroy_wq;
+
dev_info(disk_to_dev(dev->gd), "created from ubi%d:%d(%s)",
dev->ubi_num, dev->vol_id, vi->name);
mutex_unlock(&devices_mutex);
return 0;
+out_destroy_wq:
+ list_del(&dev->list);
+ destroy_workqueue(dev->wq);
out_remove_minor:
idr_remove(&ubiblock_minor_idr, gd->first_minor);
out_cleanup_disk:
--
2.30.2
WARNING: multiple messages have this Message-ID (diff)
From: Luis Chamberlain <mcgrof@kernel.org>
To: axboe@kernel.dk, bhelgaas@google.com, liushixin2@huawei.com,
thunder.leizhen@huawei.com, lee.jones@linaro.org,
geoff@infradead.org, mpe@ellerman.id.au,
benh@kernel.crashing.org, paulus@samba.org, jim@jtan.com,
haris.iqbal@ionos.com, jinpu.wang@ionos.com,
josh.h.morris@us.ibm.com, pjk1939@linux.ibm.com,
tim@cyberelk.net, richard@nod.at, miquel.raynal@bootlin.com,
vigneshr@ti.com
Cc: linux-mtd@lists.infradead.org, linuxppc-dev@lists.ozlabs.org,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
Luis Chamberlain <mcgrof@kernel.org>
Subject: [PATCH v2 10/10] mtd/ubi/block: add error handling support for add_disk()
Date: Mon, 27 Sep 2021 15:01:57 -0700 [thread overview]
Message-ID: <20210927220157.1069658-11-mcgrof@kernel.org> (raw)
In-Reply-To: <20210927220157.1069658-1-mcgrof@kernel.org>
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@kernel.org>
---
drivers/mtd/ubi/block.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/mtd/ubi/block.c b/drivers/mtd/ubi/block.c
index e003b4b44ffa..062e6c2c45f5 100644
--- a/drivers/mtd/ubi/block.c
+++ b/drivers/mtd/ubi/block.c
@@ -447,12 +447,18 @@ int ubiblock_create(struct ubi_volume_info *vi)
list_add_tail(&dev->list, &ubiblock_devices);
/* Must be the last step: anyone can call file ops from now on */
- add_disk(dev->gd);
+ ret = add_disk(dev->gd);
+ if (ret)
+ goto out_destroy_wq;
+
dev_info(disk_to_dev(dev->gd), "created from ubi%d:%d(%s)",
dev->ubi_num, dev->vol_id, vi->name);
mutex_unlock(&devices_mutex);
return 0;
+out_destroy_wq:
+ list_del(&dev->list);
+ destroy_workqueue(dev->wq);
out_remove_minor:
idr_remove(&ubiblock_minor_idr, gd->first_minor);
out_cleanup_disk:
--
2.30.2
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
WARNING: multiple messages have this Message-ID (diff)
From: Luis Chamberlain <mcgrof@kernel.org>
To: axboe@kernel.dk, bhelgaas@google.com, liushixin2@huawei.com,
thunder.leizhen@huawei.com, lee.jones@linaro.org,
geoff@infradead.org, mpe@ellerman.id.au,
benh@kernel.crashing.org, paulus@samba.org, jim@jtan.com,
haris.iqbal@ionos.com, jinpu.wang@ionos.com,
josh.h.morris@us.ibm.com, pjk1939@linux.ibm.com,
tim@cyberelk.net, richard@nod.at, miquel.raynal@bootlin.com,
vigneshr@ti.com
Cc: linux-block@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
Luis Chamberlain <mcgrof@kernel.org>,
linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 10/10] mtd/ubi/block: add error handling support for add_disk()
Date: Mon, 27 Sep 2021 15:01:57 -0700 [thread overview]
Message-ID: <20210927220157.1069658-11-mcgrof@kernel.org> (raw)
In-Reply-To: <20210927220157.1069658-1-mcgrof@kernel.org>
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@kernel.org>
---
drivers/mtd/ubi/block.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/mtd/ubi/block.c b/drivers/mtd/ubi/block.c
index e003b4b44ffa..062e6c2c45f5 100644
--- a/drivers/mtd/ubi/block.c
+++ b/drivers/mtd/ubi/block.c
@@ -447,12 +447,18 @@ int ubiblock_create(struct ubi_volume_info *vi)
list_add_tail(&dev->list, &ubiblock_devices);
/* Must be the last step: anyone can call file ops from now on */
- add_disk(dev->gd);
+ ret = add_disk(dev->gd);
+ if (ret)
+ goto out_destroy_wq;
+
dev_info(disk_to_dev(dev->gd), "created from ubi%d:%d(%s)",
dev->ubi_num, dev->vol_id, vi->name);
mutex_unlock(&devices_mutex);
return 0;
+out_destroy_wq:
+ list_del(&dev->list);
+ destroy_workqueue(dev->wq);
out_remove_minor:
idr_remove(&ubiblock_minor_idr, gd->first_minor);
out_cleanup_disk:
--
2.30.2
next prev parent reply other threads:[~2021-09-27 22:04 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-27 22:01 [PATCH v2 00/10] block: fourth batch of add_disk() error handling conversions Luis Chamberlain
2021-09-27 22:01 ` Luis Chamberlain
2021-09-27 22:01 ` Luis Chamberlain
2021-09-27 22:01 ` [PATCH v2 01/10] mtip32xx: add error handling support for add_disk() Luis Chamberlain
2021-09-27 22:01 ` Luis Chamberlain
2021-09-27 22:01 ` Luis Chamberlain
2021-09-27 22:01 ` [PATCH v2 02/10] pktcdvd: " Luis Chamberlain
2021-09-27 22:01 ` Luis Chamberlain
2021-09-27 22:01 ` Luis Chamberlain
2021-09-27 22:01 ` [PATCH v2 03/10] ps3disk: " Luis Chamberlain
2021-09-27 22:01 ` Luis Chamberlain
2021-09-27 22:01 ` Luis Chamberlain
2021-09-27 22:01 ` [PATCH v2 04/10] ps3vram: " Luis Chamberlain
2021-09-27 22:01 ` Luis Chamberlain
2021-09-27 22:01 ` Luis Chamberlain
2021-09-27 22:01 ` [PATCH v2 05/10] rnbd: " Luis Chamberlain
2021-09-27 22:01 ` Luis Chamberlain
2021-09-27 22:01 ` Luis Chamberlain
2021-09-27 22:01 ` [PATCH v2 06/10] block/rsxx: " Luis Chamberlain
2021-09-27 22:01 ` Luis Chamberlain
2021-09-27 22:01 ` Luis Chamberlain
2021-09-27 22:01 ` [PATCH v2 07/10] block/sunvdc: " Luis Chamberlain
2021-09-27 22:01 ` Luis Chamberlain
2021-09-27 22:01 ` Luis Chamberlain
2021-09-27 22:01 ` [PATCH v2 08/10] block/sx8: " Luis Chamberlain
2021-09-27 22:01 ` Luis Chamberlain
2021-09-27 22:01 ` Luis Chamberlain
2021-09-27 22:01 ` [PATCH v2 09/10] pf: " Luis Chamberlain
2021-09-27 22:01 ` Luis Chamberlain
2021-09-27 22:01 ` Luis Chamberlain
2021-09-27 22:01 ` Luis Chamberlain [this message]
2021-09-27 22:01 ` [PATCH v2 10/10] mtd/ubi/block: " Luis Chamberlain
2021-09-27 22:01 ` Luis Chamberlain
2021-09-27 22:31 ` [PATCH v2 00/10] block: fourth batch of add_disk() error handling conversions Jens Axboe
2021-09-27 22:31 ` Jens Axboe
2021-09-27 22:31 ` Jens Axboe
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=20210927220157.1069658-11-mcgrof@kernel.org \
--to=mcgrof@kernel.org \
--cc=axboe@kernel.dk \
--cc=benh@kernel.crashing.org \
--cc=bhelgaas@google.com \
--cc=geoff@infradead.org \
--cc=haris.iqbal@ionos.com \
--cc=jim@jtan.com \
--cc=jinpu.wang@ionos.com \
--cc=josh.h.morris@us.ibm.com \
--cc=lee.jones@linaro.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=liushixin2@huawei.com \
--cc=miquel.raynal@bootlin.com \
--cc=mpe@ellerman.id.au \
--cc=paulus@samba.org \
--cc=pjk1939@linux.ibm.com \
--cc=richard@nod.at \
--cc=thunder.leizhen@huawei.com \
--cc=tim@cyberelk.net \
--cc=vigneshr@ti.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.