Skip to content
Permalink
Browse files
loop: 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>
  • Loading branch information
mcgrof authored and intel-lab-lkp committed Jul 15, 2021
1 parent 60b8191 commit bc7835fa74d828de37e4f8a676d8dd45160299db
Showing 1 changed file with 8 additions and 1 deletion.
@@ -2326,10 +2326,17 @@ static int loop_add(int i)
disk->private_data = lo;
disk->queue = lo->lo_queue;
sprintf(disk->disk_name, "loop%d", i);
add_disk(disk);

err = add_disk(disk);
if (err)
goto out_cleanup_disk;

mutex_unlock(&loop_ctl_mutex);

return i;

out_cleanup_disk:
blk_cleanup_disk(disk);
out_cleanup_tags:
blk_mq_free_tag_set(&lo->tag_set);
out_free_idr:

0 comments on commit bc7835f

Please sign in to comment.