Skip to content

Commit eefe240

Browse files
committed
null_blk: fix return value from null_add_dev()
jira LE-1907 Rebuild_History Non-Buildable kernel-4.18.0-553.16.1.el8_10 commit-author Chaitanya Kulkarni <[email protected]> commit a75110c The function nullb_device_power_store() returns -ENOMEM when null_add_dev() fails. null_add_dev() can fail with return value other than -ENOMEM such as -EINVAL when Zoned Block Device option is used, see : nullb_device_power_store() null_add_dev() null_init_zoned_dev() return -EINVAL; When trying to load the module having -ENOMEM value returned on the command line creates confusion when pleanty of memory is free on the machine. Instead of hardcoding -ENOMEM return the value of null_add_dev() function. Signed-off-by: Chaitanya Kulkarni <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]> (cherry picked from commit a75110c) Signed-off-by: Jonathan Maple <[email protected]>
1 parent ce785c1 commit eefe240

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/block/null_blk_main.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -414,9 +414,10 @@ static ssize_t nullb_device_power_store(struct config_item *item,
414414
if (!dev->power && newp) {
415415
if (test_and_set_bit(NULLB_DEV_FL_UP, &dev->flags))
416416
return count;
417-
if (null_add_dev(dev)) {
417+
ret = null_add_dev(dev);
418+
if (ret) {
418419
clear_bit(NULLB_DEV_FL_UP, &dev->flags);
419-
return -ENOMEM;
420+
return ret;
420421
}
421422

422423
set_bit(NULLB_DEV_FL_CONFIGURED, &dev->flags);

0 commit comments

Comments
 (0)