Skip to content

Commit

Permalink
mm, slab: use kmem_cache_free() to free from kmem_buckets_cache
Browse files Browse the repository at this point in the history
In kmem_buckets_create(), the kmem_buckets object is allocated by
kmem_cache_alloc() from kmem_buckets_cache, but in the failure case,
it's freed by kfree(). This is not wrong, but using kmem_cache_free()
is the more common pattern, so use it.

Signed-off-by: Yan Zhen <yanzhen@vivo.com>
Reviewed-by: Christoph Lameter <cl@linux.com>
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
  • Loading branch information
Yan Zhen authored and tehcaster committed Aug 27, 2024
1 parent 1941b31 commit 3beb2fb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mm/slab_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ kmem_buckets *kmem_buckets_create(const char *name, slab_flags_t flags,
fail:
for (idx = 0; idx < ARRAY_SIZE(kmalloc_caches[KMALLOC_NORMAL]); idx++)
kmem_cache_destroy((*b)[idx]);
kfree(b);
kmem_cache_free(kmem_buckets_cache, b);

return NULL;
}
Expand Down

0 comments on commit 3beb2fb

Please sign in to comment.