Skip to content

Commit ed73919

Browse files
mcgrofaxboe
authored andcommitted
mtd/ubi/block: 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. Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Luis Chamberlain <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent f583eae commit ed73919

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

drivers/mtd/ubi/block.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,12 +447,18 @@ int ubiblock_create(struct ubi_volume_info *vi)
447447
list_add_tail(&dev->list, &ubiblock_devices);
448448

449449
/* Must be the last step: anyone can call file ops from now on */
450-
add_disk(dev->gd);
450+
ret = add_disk(dev->gd);
451+
if (ret)
452+
goto out_destroy_wq;
453+
451454
dev_info(disk_to_dev(dev->gd), "created from ubi%d:%d(%s)",
452455
dev->ubi_num, dev->vol_id, vi->name);
453456
mutex_unlock(&devices_mutex);
454457
return 0;
455458

459+
out_destroy_wq:
460+
list_del(&dev->list);
461+
destroy_workqueue(dev->wq);
456462
out_remove_minor:
457463
idr_remove(&ubiblock_minor_idr, gd->first_minor);
458464
out_cleanup_disk:

0 commit comments

Comments
 (0)