Message ID | 20190604014454.6652-1-eamanu@eamanu.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Make more redeable the kmalloc function | expand |
On Mon, Jun 03, 2019 at 10:44:54PM -0300, Emmanuel Arias wrote: > The ``if```check of size > KMALLOC_MAX_CACHE_SIZE was between the same > preprocessor directive. I join the the directives to be more redeable. > static __always_inline void *kmalloc(size_t size, gfp_t flags) > { > if (__builtin_constant_p(size)) { > -#ifndef CONFIG_SLOB > - unsigned int index; > -#endif > if (size > KMALLOC_MAX_CACHE_SIZE) > return kmalloc_large(size, flags); > #ifndef CONFIG_SLOB > + unsigned int index; > index = kmalloc_index(size); You didn't get a new warning from -Wdeclaration-after-statement?
diff --git a/include/linux/slab.h b/include/linux/slab.h index 11b45f7ae405..90753231c191 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h @@ -531,12 +531,10 @@ static __always_inline void *kmalloc_large(size_t size, gfp_t flags) static __always_inline void *kmalloc(size_t size, gfp_t flags) { if (__builtin_constant_p(size)) { -#ifndef CONFIG_SLOB - unsigned int index; -#endif if (size > KMALLOC_MAX_CACHE_SIZE) return kmalloc_large(size, flags); #ifndef CONFIG_SLOB + unsigned int index; index = kmalloc_index(size); if (!index)
The ``if```check of size > KMALLOC_MAX_CACHE_SIZE was between the same preprocessor directive. I join the the directives to be more redeable. Signed-off-by: Emmanuel Arias <eamanu@eamanu.com> --- include/linux/slab.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)