mm/slab: remove duplicate check in create_cache()

The WARN_ON() check in static function create_cache() is done by its only
parent __kmem_cache_create_args() before calling it.
	if (... ||
	    WARN_ON(... ||
		    object_size - args->usersize < args->useroffset))
		args->usersize = args->useroffset = 0;
	...
	s = create_cache(cache_name, object_size, args, flags);

Therefore, the WARN_ON() check in create_cache() can be safely removed.

Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
This commit is contained in:
Zhen Lei 2024-10-09 11:54:55 +08:00 committed by Vlastimil Babka
parent 1e4df1859e
commit b4b797d877

View File

@ -222,9 +222,6 @@ static struct kmem_cache *create_cache(const char *name,
struct kmem_cache *s;
int err;
if (WARN_ON(args->useroffset + args->usersize > object_size))
args->useroffset = args->usersize = 0;
/* If a custom freelist pointer is requested make sure it's sane. */
err = -EINVAL;
if (args->use_freeptr_offset &&