Skip to content

Commit

Permalink
s390/block/dcssblk: add error handling support for add_disk()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Gerald Schaefer <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Heiko Carstens <[email protected]>
Signed-off-by: Vasily Gorbik <[email protected]>
  • Loading branch information
gerald-schaefer authored and Vasily Gorbik committed Oct 4, 2021
1 parent 11dfe19 commit 1a5db70
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion drivers/s390/block/dcssblk.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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);
Expand Down

0 comments on commit 1a5db70

Please sign in to comment.