From: Wei Yongjun Date: Tue, 17 Oct 2017 12:11:46 +0000 (+0000) Subject: nullb: fix error return code in null_init() X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=30c516d750396c5f3ec9cb04c9e025c25e91495e;p=openwrt%2Fstaging%2Fblogic.git 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 Signed-off-by: Jens Axboe --- 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);