All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luis Chamberlain <mcgrof@kernel.org>
To: axboe@kernel.dk, gregkh@linuxfoundation.org,
	chaitanya.kulkarni@wdc.com, atulgopinathan@gmail.com,
	hare@suse.de, maximlevitsky@gmail.com, oakad@yahoo.com,
	ulf.hansson@linaro.org, colin.king@canonical.com,
	shubhankarvk@gmail.com, baijiaju1990@gmail.com, trix@redhat.com,
	dongsheng.yang@easystack.cn, ceph-devel@vger.kernel.org,
	miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com,
	sth@linux.ibm.com, hoeppner@linux.ibm.com, hca@linux.ibm.com,
	gor@linux.ibm.com, borntraeger@de.ibm.com, oberpar@linux.ibm.com,
	tj@kernel.org
Cc: linux-s390@vger.kernel.org, linux-mtd@lists.infradead.org,
	linux-mmc@vger.kernel.org, linux-block@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Luis Chamberlain <mcgrof@kernel.org>
Subject: [PATCH 6/9] s390/block/dasd_genhd: add error handling support for add_disk()
Date: Thu,  2 Sep 2021 10:41:02 -0700	[thread overview]
Message-ID: <20210902174105.2418771-7-mcgrof@kernel.org> (raw)
In-Reply-To: <20210902174105.2418771-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/s390/block/dasd_genhd.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/s390/block/dasd_genhd.c b/drivers/s390/block/dasd_genhd.c
index fa966e0db6ca..ba07022283bc 100644
--- a/drivers/s390/block/dasd_genhd.c
+++ b/drivers/s390/block/dasd_genhd.c
@@ -33,7 +33,7 @@ int dasd_gendisk_alloc(struct dasd_block *block)
 {
 	struct gendisk *gdp;
 	struct dasd_device *base;
-	int len;
+	int len, rc;
 
 	/* Make sure the minor for this device exists. */
 	base = block->base;
@@ -79,7 +79,11 @@ int dasd_gendisk_alloc(struct dasd_block *block)
 	dasd_add_link_to_gendisk(gdp, base);
 	block->gdp = gdp;
 	set_capacity(block->gdp, 0);
-	device_add_disk(&base->cdev->dev, block->gdp, NULL);
+
+	rc = device_add_disk(&base->cdev->dev, block->gdp, NULL);
+	if (rc)
+		return rc;
+
 	return 0;
 }
 
-- 
2.30.2


WARNING: multiple messages have this Message-ID
From: Luis Chamberlain <mcgrof@kernel.org>
To: axboe@kernel.dk, gregkh@linuxfoundation.org,
	chaitanya.kulkarni@wdc.com, atulgopinathan@gmail.com,
	hare@suse.de, maximlevitsky@gmail.com, oakad@yahoo.com,
	ulf.hansson@linaro.org, colin.king@canonical.com,
	shubhankarvk@gmail.com, baijiaju1990@gmail.com, trix@redhat.com,
	dongsheng.yang@easystack.cn, ceph-devel@vger.kernel.org,
	miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com,
	sth@linux.ibm.com, hoeppner@linux.ibm.com, hca@linux.ibm.com,
	gor@linux.ibm.com, borntraeger@de.ibm.com, oberpar@linux.ibm.com,
	tj@kernel.org
Cc: linux-s390@vger.kernel.org, linux-mtd@lists.infradead.org,
	linux-mmc@vger.kernel.org, linux-block@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Luis Chamberlain <mcgrof@kernel.org>
Subject: [PATCH 6/9] s390/block/dasd_genhd: add error handling support for add_disk()
Date: Thu,  2 Sep 2021 10:41:02 -0700	[thread overview]
Message-ID: <20210902174105.2418771-7-mcgrof@kernel.org> (raw)
In-Reply-To: <20210902174105.2418771-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/s390/block/dasd_genhd.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/s390/block/dasd_genhd.c b/drivers/s390/block/dasd_genhd.c
index fa966e0db6ca..ba07022283bc 100644
--- a/drivers/s390/block/dasd_genhd.c
+++ b/drivers/s390/block/dasd_genhd.c
@@ -33,7 +33,7 @@ int dasd_gendisk_alloc(struct dasd_block *block)
 {
 	struct gendisk *gdp;
 	struct dasd_device *base;
-	int len;
+	int len, rc;
 
 	/* Make sure the minor for this device exists. */
 	base = block->base;
@@ -79,7 +79,11 @@ int dasd_gendisk_alloc(struct dasd_block *block)
 	dasd_add_link_to_gendisk(gdp, base);
 	block->gdp = gdp;
 	set_capacity(block->gdp, 0);
-	device_add_disk(&base->cdev->dev, block->gdp, NULL);
+
+	rc = device_add_disk(&base->cdev->dev, block->gdp, NULL);
+	if (rc)
+		return rc;
+
 	return 0;
 }
 
-- 
2.30.2


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

  parent reply	other threads:[~2021-09-02 17:41 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-02 17:40 [PATCH 0/9] block: 5th batch of add_disk() error handling conversions Luis Chamberlain
2021-09-02 17:40 ` Luis Chamberlain
2021-09-02 17:40 ` [PATCH 1/9] cdrom/gdrom: add error handling support for add_disk() Luis Chamberlain
2021-09-02 17:40   ` Luis Chamberlain
2021-09-02 17:40 ` [PATCH 2/9] ms_block: " Luis Chamberlain
2021-09-02 17:40   ` Luis Chamberlain
2021-09-06 17:10   ` Ulf Hansson
2021-09-06 17:10     ` Ulf Hansson
2021-09-02 17:40 ` [PATCH 3/9] mspro_block: " Luis Chamberlain
2021-09-02 17:40   ` Luis Chamberlain
2021-09-06 17:10   ` Ulf Hansson
2021-09-06 17:10     ` Ulf Hansson
2021-09-02 17:41 ` [PATCH 4/9] rbd: add add_disk() error handling Luis Chamberlain
2021-09-02 17:41   ` Luis Chamberlain
2021-09-02 17:41 ` [PATCH 5/9] mtd: " Luis Chamberlain
2021-09-02 17:41   ` Luis Chamberlain
2021-09-02 19:09   ` Miquel Raynal
2021-09-02 19:09     ` Miquel Raynal
2021-09-02 17:41 ` Luis Chamberlain [this message]
2021-09-02 17:41   ` [PATCH 6/9] s390/block/dasd_genhd: add error handling support for add_disk() Luis Chamberlain
2021-09-13  8:17   ` Jan Höppner
2021-09-13  8:17     ` Jan Höppner
2021-09-13  8:42     ` Christoph Hellwig
2021-09-13  8:42       ` Christoph Hellwig
2021-09-13 12:15       ` Jan Höppner
2021-09-13 12:15         ` Jan Höppner
2021-09-13 12:19     ` Jan Höppner
2021-09-13 12:19       ` Jan Höppner
2021-09-13 16:51       ` Luis Chamberlain
2021-09-13 16:51         ` Luis Chamberlain
2021-09-15 14:57         ` Jan Höppner
2021-09-15 14:57           ` Jan Höppner
2021-09-02 17:41 ` [PATCH 7/9] s390/block/dcssblk: " Luis Chamberlain
2021-09-02 17:41   ` Luis Chamberlain
2021-09-03 14:08   ` Heiko Carstens
2021-09-03 14:08     ` Heiko Carstens
2021-09-04  1:46     ` Luis Chamberlain
2021-09-04  1:46       ` Luis Chamberlain
2021-09-06 11:43       ` Gerald Schaefer
2021-09-06 11:43         ` Gerald Schaefer
2021-09-06 14:33         ` Heiko Carstens
2021-09-06 14:33           ` Heiko Carstens
2021-09-13 16:53         ` Luis Chamberlain
2021-09-13 16:53           ` Luis Chamberlain
2021-09-23  8:52           ` Heiko Carstens
2021-09-23  8:52             ` Heiko Carstens
2021-09-02 17:41 ` [PATCH 8/9] s390/block/scm_blk: " Luis Chamberlain
2021-09-02 17:41   ` Luis Chamberlain
2021-09-03 14:30   ` Heiko Carstens
2021-09-03 14:30     ` Heiko Carstens
2021-09-02 17:41 ` [PATCH 9/9] s390/block/xpram: " Luis Chamberlain
2021-09-02 17:41   ` Luis Chamberlain
2021-09-03 14:06   ` Heiko Carstens
2021-09-03 14:06     ` Heiko Carstens
2021-09-04  1:44     ` Luis Chamberlain
2021-09-04  1:44       ` Luis Chamberlain
2021-09-06  9:15     ` Christoph Hellwig
2021-09-06  9:15       ` Christoph Hellwig
2021-09-06 14:35       ` Heiko Carstens
2021-09-06 14:35         ` Heiko Carstens

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=20210902174105.2418771-7-mcgrof@kernel.org \
    --to=mcgrof@kernel.org \
    --cc=atulgopinathan@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=baijiaju1990@gmail.com \
    --cc=borntraeger@de.ibm.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=chaitanya.kulkarni@wdc.com \
    --cc=colin.king@canonical.com \
    --cc=dongsheng.yang@easystack.cn \
    --cc=gor@linux.ibm.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hare@suse.de \
    --cc=hca@linux.ibm.com \
    --cc=hoeppner@linux.ibm.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=maximlevitsky@gmail.com \
    --cc=miquel.raynal@bootlin.com \
    --cc=oakad@yahoo.com \
    --cc=oberpar@linux.ibm.com \
    --cc=richard@nod.at \
    --cc=shubhankarvk@gmail.com \
    --cc=sth@linux.ibm.com \
    --cc=tj@kernel.org \
    --cc=trix@redhat.com \
    --cc=ulf.hansson@linaro.org \
    --cc=vigneshr@ti.com \
    --subject='Re: [PATCH 6/9] s390/block/dasd_genhd: add error handling support for add_disk()' \
    /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

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.