slub: Correct the error code when slab_kset is NULL
authorXiongwei Song <xiongwei.song@windriver.com>
Thu, 13 Apr 2023 14:34:48 +0000 (22:34 +0800)
committerVlastimil Babka <vbabka@suse.cz>
Mon, 22 May 2023 13:20:21 +0000 (15:20 +0200)
The -ENOSYS is inproper when kset_create_and_add call returns a NULL
pointer, the failure more likely is because lacking memory, hence
returning -ENOMEM is better.

Signed-off-by: Xiongwei Song <xiongwei.song@windriver.com>
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
mm/slub.c

index c87628cd8a9af364cc431beab9ffbdd4074ab2fd..1202ed1200f96dd35e62e128d9c414007feb7c34 100644 (file)
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -6224,7 +6224,7 @@ static int __init slab_sysfs_init(void)
        if (!slab_kset) {
                mutex_unlock(&slab_mutex);
                pr_err("Cannot register slab subsystem.\n");
-               return -ENOSYS;
+               return -ENOMEM;
        }
 
        slab_state = FULL;