summaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorAlexandru Moise <00moses.alexander00@gmail.com>2015-11-05 18:45:43 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2015-11-05 19:34:48 -0800
commit40911a798b5abbbec6b2e271a42addd6b26228a0 (patch)
tree28804bff5d9fe24393ff8cc391138122bbf61ac3 /mm
parent76f8ec712aa94da9fbfc9c318edc89aa1e48006b (diff)
downloadop-kernel-dev-40911a798b5abbbec6b2e271a42addd6b26228a0.zip
op-kernel-dev-40911a798b5abbbec6b2e271a42addd6b26228a0.tar.gz
mm/slab_common.c: initialize kmem_cache pointer to NULL
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> Acked-by: David Rientjes <rientjes@google.com> Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/slab_common.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/mm/slab_common.c b/mm/slab_common.c
index fba78e4..d88e97c 100644
--- a/mm/slab_common.c
+++ b/mm/slab_common.c
@@ -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;
}
OpenPOWER on IntegriCloud