Skip to content

Commit b9dad15

Browse files
Zhen Leitehcaster
authored andcommitted
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 <thunder.leizhen@huawei.com> Reviewed-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
1 parent d2e527f commit b9dad15

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

mm/slab_common.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -236,14 +236,12 @@ static struct kmem_cache *create_cache(const char *name,
236236

237237
s->refcount = 1;
238238
list_add(&s->list, &slab_caches);
239-
out:
240-
if (err)
241-
return ERR_PTR(err);
242239
return s;
243240

244241
out_free_cache:
245242
kmem_cache_free(kmem_cache, s);
246-
goto out;
243+
out:
244+
return ERR_PTR(err);
247245
}
248246

249247
/**

0 commit comments

Comments
 (0)