Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1251971 > unrolled thread
| Started by | Alexandru Moise <00moses.alexander00@gmail.com> |
|---|---|
| First post | 2015-10-20 21:10 +0200 |
| Last post | 2015-10-21 22:40 +0200 |
| Articles | 3 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH] mm: initialize kmem_cache pointer to NULL Alexandru Moise <00moses.alexander00@gmail.com> - 2015-10-20 21:10 +0200
Re: [PATCH] mm: initialize kmem_cache pointer to NULL Christoph Lameter <cl@linux.com> - 2015-10-20 22:10 +0200
Re: [PATCH] mm: initialize kmem_cache pointer to NULL David Rientjes <rientjes@google.com> - 2015-10-21 22:40 +0200
| From | Alexandru Moise <00moses.alexander00@gmail.com> |
|---|---|
| Date | 2015-10-20 21:10 +0200 |
| Subject | [PATCH] mm: initialize kmem_cache pointer to NULL |
| Message-ID | <qlKsj-4o0-29@gated-at.bofh.it> |
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>
---
mm/slab_common.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/mm/slab_common.c b/mm/slab_common.c
index 5ce4fae..cf0b7bb 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;
}
--
2.6.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Christoph Lameter <cl@linux.com> |
|---|---|
| Date | 2015-10-20 22:10 +0200 |
| Message-ID | <qlLol-5IJ-7@gated-at.bofh.it> |
| In reply to | #1251971 |
On Tue, 20 Oct 2015, Alexandru Moise wrote: > 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. Acked-by: Christoph Lameter <cl@linux.com> -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | David Rientjes <rientjes@google.com> |
|---|---|
| Date | 2015-10-21 22:40 +0200 |
| Message-ID | <qm8kV-5Cw-1@gated-at.bofh.it> |
| In reply to | #1251971 |
On Tue, 20 Oct 2015, Alexandru Moise wrote: > 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: David Rientjes <rientjes@google.com> -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web