Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 30c516d7 authored by Wei Yongjun's avatar Wei Yongjun Committed by Jens Axboe
Browse files

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: 2984c868 ("nullb: factor disk parameters")
Signed-off-by: default avatarWei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 519c8e9f
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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);