diff options
author | Gerald Schaefer <gerald.schaefer@linux.ibm.com> | 2021-09-28 00:02:31 +0200 |
---|---|---|
committer | Vasily Gorbik <gor@linux.ibm.com> | 2021-10-04 09:49:37 +0200 |
commit | 1a5db707c859a4f63c1066c5b88864d3f1c21c12 (patch) | |
tree | b6fca2558c7da03b4cb047b9fbf9fb7e9ebd9349 | |
parent | s390/block/dasd_genhd: add error handling support for add_disk() (diff) | |
download | linux-1a5db707c859a4f63c1066c5b88864d3f1c21c12.tar.xz linux-1a5db707c859a4f63c1066c5b88864d3f1c21c12.zip |
s390/block/dcssblk: 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.
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
Signed-off-by: Gerald Schaefer <gerald.schaefer@linux.ibm.com>
Link: https://lore.kernel.org/r/20210927220232.1071926-6-mcgrof@kernel.org
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
-rw-r--r-- | drivers/s390/block/dcssblk.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/s390/block/dcssblk.c b/drivers/s390/block/dcssblk.c index 5be3d1c39a78..0741a9321712 100644 --- a/drivers/s390/block/dcssblk.c +++ b/drivers/s390/block/dcssblk.c @@ -696,7 +696,9 @@ dcssblk_add_store(struct device *dev, struct device_attribute *attr, const char } get_device(&dev_info->dev); - device_add_disk(&dev_info->dev, dev_info->gd, NULL); + rc = device_add_disk(&dev_info->dev, dev_info->gd, NULL); + if (rc) + goto out_dax; switch (dev_info->segment_type) { case SEG_TYPE_SR: @@ -712,6 +714,10 @@ dcssblk_add_store(struct device *dev, struct device_attribute *attr, const char rc = count; goto out; +out_dax: + put_device(&dev_info->dev); + kill_dax(dev_info->dax_dev); + put_dax(dev_info->dax_dev); put_dev: list_del(&dev_info->lh); blk_cleanup_disk(dev_info->gd); |