mm, slab: use kmem_cache_free() to free from kmem_buckets_cache

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>
This commit is contained in:
Yan Zhen 2024-08-22 10:27:04 +08:00 committed by Vlastimil Babka
parent 1941b31482
commit 3beb2fb681

View File

@ -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;
}