]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
mm/slab_common.c: initialize kmem_cache pointer to NULL
authorAlexandru Moise <00moses.alexander00@gmail.com>
Wed, 21 Oct 2015 22:02:53 +0000 (09:02 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 21 Oct 2015 22:02:53 +0000 (09:02 +1100)
The assignment to NULL within the error condition was written in a 2014
patch to suppress a compiler warning.  However it would be cleaner to just
initialize the kmem_cache to NULL and just return it in case of an error
condition.

Signed-off-by: Alexandru Moise <00moses.alexander00@gmail.com>
Acked-by: Christoph Lameter <cl@linux.com>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: David Rientjes <rientjes@google.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/slab_common.c

index fba78e4a66430410080e269af418ca08f26eb326..d88e97c10a2e31669753681efc74f6bf50fdf2ef 100644 (file)
@@ -384,7 +384,7 @@ struct kmem_cache *
 kmem_cache_create(const char *name, size_t size, size_t align,
                  unsigned long flags, void (*ctor)(void *))
 {
-       struct kmem_cache *s;
+       struct kmem_cache *s = NULL;
        const char *cache_name;
        int err;
 
@@ -396,7 +396,6 @@ kmem_cache_create(const char *name, size_t size, size_t align,
 
        err = kmem_cache_sanity_check(name, size);
        if (err) {
-               s = NULL;       /* suppress uninit var warning */
                goto out_unlock;
        }