diff options
author | Wei Yongjun <weiyongjun1@huawei.com> | 2017-10-17 12:11:46 +0000 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2017-10-17 08:25:06 -0600 |
commit | 30c516d750396c5f3ec9cb04c9e025c25e91495e (patch) | |
tree | 706414ddba2e8053d89899270e16f552c65479e6 /drivers/block | |
parent | 519c8e9ffd86143fedd84cf833a09f36b47d0f5c (diff) | |
download | linux-30c516d750396c5f3ec9cb04c9e025c25e91495e.tar.bz2 |
nullb: fix error return code in null_init()
Fix to return error code -ENOMEM from the null_alloc_dev() error
handling case instead of 0, as done elsewhere in this function.
Fixes: 2984c8684f96 ("nullb: factor disk parameters")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/null_blk.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/block/null_blk.c b/drivers/block/null_blk.c index bf2c8ca3242a..50c83c4b2ea0 100644 --- a/drivers/block/null_blk.c +++ b/drivers/block/null_blk.c @@ -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); |