Commit 11dfe199 authored by Luis Chamberlain's avatar Luis Chamberlain Committed by Vasily Gorbik

s390/block/dasd_genhd: 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.

Be sure to call dasd_gendisk_free() on error.
Signed-off-by: default avatarLuis Chamberlain <mcgrof@kernel.org>
Link: https://lore.kernel.org/r/20210927220232.1071926-5-mcgrof@kernel.orgSigned-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
parent e3ec8e0f
...@@ -33,7 +33,7 @@ int dasd_gendisk_alloc(struct dasd_block *block) ...@@ -33,7 +33,7 @@ int dasd_gendisk_alloc(struct dasd_block *block)
{ {
struct gendisk *gdp; struct gendisk *gdp;
struct dasd_device *base; struct dasd_device *base;
int len; int len, rc;
/* Make sure the minor for this device exists. */ /* Make sure the minor for this device exists. */
base = block->base; base = block->base;
...@@ -79,7 +79,13 @@ int dasd_gendisk_alloc(struct dasd_block *block) ...@@ -79,7 +79,13 @@ int dasd_gendisk_alloc(struct dasd_block *block)
dasd_add_link_to_gendisk(gdp, base); dasd_add_link_to_gendisk(gdp, base);
block->gdp = gdp; block->gdp = gdp;
set_capacity(block->gdp, 0); 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) {
dasd_gendisk_free(block);
return rc;
}
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment