From: Zhen Lei Date: Tue, 6 Jun 2023 06:55:43 +0000 (+0800) Subject: mm/slab_common: reduce an if statement in create_cache() X-Git-Tag: v6.5-rc1~137^2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b9dad156af1fd6c66ffa40f007c09823a8319abe;p=thirdparty%2Fkernel%2Flinux.git mm/slab_common: reduce an if statement in create_cache() 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 Reviewed-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> Signed-off-by: Vlastimil Babka --- diff --git a/mm/slab_common.c b/mm/slab_common.c index 607249785c077..f6fe351057749 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c @@ -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); } /**