aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhen Lei <[email protected]>2023-06-06 14:55:43 +0800
committerVlastimil Babka <[email protected]>2023-06-06 10:37:19 +0200
commitb9dad156af1fd6c66ffa40f007c09823a8319abe (patch)
tree84502ce8462fb620c89902a4eb0711baf17f62c5
parentd2e527f0d8d1124b1fab93e2e7b2c6a114c0e5a2 (diff)
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 <[email protected]> Reviewed-by: Hyeonggon Yoo <[email protected]> Signed-off-by: Vlastimil Babka <[email protected]>
-rw-r--r--mm/slab_common.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/mm/slab_common.c b/mm/slab_common.c
index 607249785c07..f6fe35105774 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);
}
/**