mm/slab_common: reduce an if statement in create_cache()
authorZhen Lei <thunder.leizhen@huawei.com>
Tue, 6 Jun 2023 06:55:43 +0000 (14:55 +0800)
committerVlastimil Babka <vbabka@suse.cz>
Tue, 6 Jun 2023 08:37:19 +0000 (10:37 +0200)
Move the 'out:' statement block out of the successful path to avoid
redundant check on 'err'. The value of 'err' is always zero on success
and negative on failure.

No functional changes, no performance improvements, just a little more
readability.

Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
Reviewed-by: Hyeonggon Yoo <42.hyeyoo@gmail.com>
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
mm/slab_common.c

index 607249785c077e922951cf808f28d9f05dcbaae6..f6fe3510577494483a6b0b9f3e1975760b75d4ac 100644 (file)
@@ -236,14 +236,12 @@ static struct kmem_cache *create_cache(const char *name,
 
        s->refcount = 1;
        list_add(&s->list, &slab_caches);
-out:
-       if (err)
-               return ERR_PTR(err);
        return s;
 
 out_free_cache:
        kmem_cache_free(kmem_cache, s);
-       goto out;
+out:
+       return ERR_PTR(err);
 }
 
 /**