summaryrefslogtreecommitdiff
path: root/drivers/s390/block/scm_blk.c
diff options
context:
space:
mode:
authorLuis Chamberlain <mcgrof@kernel.org>2021-09-28 01:02:32 +0300
committerVasily Gorbik <gor@linux.ibm.com>2021-10-04 10:49:37 +0300
commitf367c7d9fb326996862f6b5cf2aff7a2df64692d (patch)
tree358b7c7d6f935dda890058709fbab85e9929fae5 /drivers/s390/block/scm_blk.c
parent1a5db707c859a4f63c1066c5b88864d3f1c21c12 (diff)
downloadlinux-f367c7d9fb326996862f6b5cf2aff7a2df64692d.tar.xz
s390/block/scm_blk: 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. Acked-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org> Link: https://lore.kernel.org/r/20210927220232.1071926-7-mcgrof@kernel.org Signed-off-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Diffstat (limited to 'drivers/s390/block/scm_blk.c')
-rw-r--r--drivers/s390/block/scm_blk.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/s390/block/scm_blk.c b/drivers/s390/block/scm_blk.c
index 88cba6212ee2..61ecdcb2cc6a 100644
--- a/drivers/s390/block/scm_blk.c
+++ b/drivers/s390/block/scm_blk.c
@@ -495,9 +495,14 @@ int scm_blk_dev_setup(struct scm_blk_dev *bdev, struct scm_device *scmdev)
/* 512 byte sectors */
set_capacity(bdev->gendisk, scmdev->size >> 9);
- device_add_disk(&scmdev->dev, bdev->gendisk, NULL);
+ ret = device_add_disk(&scmdev->dev, bdev->gendisk, NULL);
+ if (ret)
+ goto out_cleanup_disk;
+
return 0;
+out_cleanup_disk:
+ blk_cleanup_disk(bdev->gendisk);
out_tag:
blk_mq_free_tag_set(&bdev->tag_set);
out: