public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Luis Chamberlain <mcgrof@kernel•org>
To: axboe@kernel•dk, geoff@infradead•org, mpe@ellerman•id.au,
	benh@kernel•crashing.org, paulus@samba•org, jim@jtan•com,
	minchan@kernel•org, ngupta@vflare•org, senozhatsky@chromium•org,
	richard@nod•at, miquel.raynal@bootlin•com, vigneshr@ti•com,
	dan.j.williams@intel•com, vishal.l.verma@intel•com,
	dave.jiang@intel•com, ira.weiny@intel•com, kbusch@kernel•org,
	hch@lst•de, sagi@grimberg•me
Cc: nvdimm@lists•linux.dev, linux-kernel@vger•kernel.org,
	linux-nvme@lists•infradead.org, linux-block@vger•kernel.org,
	Luis Chamberlain <mcgrof@kernel•org>,
	linux-mtd@lists•infradead.org, linuxppc-dev@lists•ozlabs.org
Subject: [PATCH 08/13] zram: add error handling support for add_disk()
Date: Fri, 15 Oct 2021 16:52:14 -0700	[thread overview]
Message-ID: <20211015235219.2191207-9-mcgrof@kernel.org> (raw)
In-Reply-To: <20211015235219.2191207-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/block/zram/zram_drv.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 0a9309a2ef54..bdbded107e6b 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -1983,7 +1983,9 @@ static int zram_add(void)
 		blk_queue_max_write_zeroes_sectors(zram->disk->queue, UINT_MAX);
 
 	blk_queue_flag_set(QUEUE_FLAG_STABLE_WRITES, zram->disk->queue);
-	device_add_disk(NULL, zram->disk, zram_disk_attr_groups);
+	ret = device_add_disk(NULL, zram->disk, zram_disk_attr_groups);
+	if (ret)
+		goto out_cleanup_disk;
 
 	strlcpy(zram->compressor, default_compressor, sizeof(zram->compressor));
 
@@ -1991,6 +1993,8 @@ static int zram_add(void)
 	pr_info("Added device: %s\n", zram->disk->disk_name);
 	return device_id;
 
+out_cleanup_disk:
+	blk_cleanup_disk(zram->disk);
 out_free_idr:
 	idr_remove(&zram_index_idr, device_id);
 out_free_dev:
-- 
2.30.2


  parent reply	other threads:[~2021-10-16  0:01 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-15 23:52 [PATCH 00/13] block: add_disk() error handling stragglers Luis Chamberlain
2021-10-15 23:52 ` [PATCH 01/13] block/brd: add error handling support for add_disk() Luis Chamberlain
2021-10-15 23:52 ` [PATCH 02/13] nvme-multipath: " Luis Chamberlain
2021-10-16  0:01   ` Keith Busch
2021-10-16  4:39   ` Christoph Hellwig
2021-10-18  5:34   ` Chaitanya Kulkarni
2021-10-15 23:52 ` [PATCH 03/13] nvdimm/btt: do not call del_gendisk() if not needed Luis Chamberlain
2021-10-31 17:47   ` Dan Williams
2021-11-02 17:03     ` Luis Chamberlain
2021-10-15 23:52 ` [PATCH 04/13] nvdimm/btt: use goto error labels on btt_blk_init() Luis Chamberlain
2021-10-31 17:51   ` Dan Williams
2021-10-15 23:52 ` [PATCH 05/13] nvdimm/btt: add error handling support for add_disk() Luis Chamberlain
2021-10-15 23:52 ` [PATCH 06/13] nvdimm/blk: avoid calling del_gendisk() on early failures Luis Chamberlain
2021-10-16  0:13   ` Dan Williams
2021-10-19 16:06     ` Luis Chamberlain
2021-11-03  0:10     ` Luis Chamberlain
2021-11-03  0:49       ` Dan Williams
2021-11-03  1:28         ` Jens Axboe
2021-11-03 12:09           ` Luis Chamberlain
2021-11-03 12:08         ` Luis Chamberlain
2021-10-15 23:52 ` [PATCH 07/13] nvdimm/blk: add error handling support for add_disk() Luis Chamberlain
2021-10-15 23:52 ` Luis Chamberlain [this message]
2021-10-25 16:55   ` [PATCH 08/13] zram: " Minchan Kim
2021-10-15 23:52 ` [PATCH 09/13] z2ram: " Luis Chamberlain
2021-10-15 23:52 ` [PATCH 10/13] ps3disk: " Luis Chamberlain
2021-10-29 15:05   ` Geoff Levand
2021-10-15 23:52 ` [PATCH 11/13] ps3vram: " Luis Chamberlain
2021-10-29 15:09   ` Geoff Levand
2021-10-15 23:52 ` [PATCH 12/13] block/sunvdc: " Luis Chamberlain
2021-10-15 23:52 ` [PATCH 13/13] mtd/ubi/block: " Luis Chamberlain
2021-10-17 15:26 ` [PATCH 00/13] block: add_disk() error handling stragglers Geoff Levand
2021-10-18 16:15   ` Luis Chamberlain
2021-10-22  3:10     ` Geoff Levand
2021-10-25 15:58       ` Luis Chamberlain
2021-10-30 17:03 ` (subset) " Jens Axboe
2021-10-30 17:07 ` 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=20211015235219.2191207-9-mcgrof@kernel.org \
    --to=mcgrof@kernel$(echo .)org \
    --cc=axboe@kernel$(echo .)dk \
    --cc=benh@kernel$(echo .)crashing.org \
    --cc=dan.j.williams@intel$(echo .)com \
    --cc=dave.jiang@intel$(echo .)com \
    --cc=geoff@infradead$(echo .)org \
    --cc=hch@lst$(echo .)de \
    --cc=ira.weiny@intel$(echo .)com \
    --cc=jim@jtan$(echo .)com \
    --cc=kbusch@kernel$(echo .)org \
    --cc=linux-block@vger$(echo .)kernel.org \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=linux-mtd@lists$(echo .)infradead.org \
    --cc=linux-nvme@lists$(echo .)infradead.org \
    --cc=linuxppc-dev@lists$(echo .)ozlabs.org \
    --cc=minchan@kernel$(echo .)org \
    --cc=miquel.raynal@bootlin$(echo .)com \
    --cc=mpe@ellerman$(echo .)id.au \
    --cc=ngupta@vflare$(echo .)org \
    --cc=nvdimm@lists$(echo .)linux.dev \
    --cc=paulus@samba$(echo .)org \
    --cc=richard@nod$(echo .)at \
    --cc=sagi@grimberg$(echo .)me \
    --cc=senozhatsky@chromium$(echo .)org \
    --cc=vigneshr@ti$(echo .)com \
    --cc=vishal.l.verma@intel$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox