Skip to content

Commit

Permalink
nullb: fix error return code in null_init()
Browse files Browse the repository at this point in the history
Fix to return error code -ENOMEM from the null_alloc_dev() error
handling case instead of 0, as done elsewhere in this function.

Fixes: 2984c86 ("nullb: factor disk parameters")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Wei Yongjun authored and Jens Axboe committed Oct 17, 2017
1 parent 519c8e9 commit 30c516d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/block/null_blk.c
Original file line number Diff line number Diff line change
Expand Up @@ -1991,8 +1991,10 @@ static int __init null_init(void)

for (i = 0; i < nr_devices; i++) {
dev = null_alloc_dev();
if (!dev)
if (!dev) {
ret = -ENOMEM;
goto err_dev;
}
ret = null_add_dev(dev);
if (ret) {
null_free_dev(dev);
Expand Down

0 comments on commit 30c516d

Please sign in to comment.