[JFFS2] kmem_cache_alloc/memset -> kmem_cache_zalloc

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Fri Mar 20 14:59:17 EDT 2009


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=c6d59cdd412e1ae34ad9c8dc69eaabada792f7ae
Commit:     c6d59cdd412e1ae34ad9c8dc69eaabada792f7ae
Parent:     bfc492571e7ad1eb4b9fe3ac8ab0a7cdaecf8eca
Author:     Wei Yongjun <yjwei at cn.fujitsu.com>
AuthorDate: Wed Mar 4 12:01:35 2009 -0800
Committer:  David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Fri Mar 20 12:24:45 2009 +0000

    [JFFS2] kmem_cache_alloc/memset -> kmem_cache_zalloc
    
    Used kmem_cache_zalloc instead of kmem_cache_alloc/memset.
    
    Signed-off-by: Wei Yongjun <yjwei at cn.fujitsu.com>
    Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
    Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
 fs/jffs2/malloc.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/fs/jffs2/malloc.c b/fs/jffs2/malloc.c
index f921125..9eff2bd 100644
--- a/fs/jffs2/malloc.c
+++ b/fs/jffs2/malloc.c
@@ -284,10 +284,9 @@ void jffs2_free_inode_cache(struct jffs2_inode_cache *x)
 struct jffs2_xattr_datum *jffs2_alloc_xattr_datum(void)
 {
 	struct jffs2_xattr_datum *xd;
-	xd = kmem_cache_alloc(xattr_datum_cache, GFP_KERNEL);
+	xd = kmem_cache_zalloc(xattr_datum_cache, GFP_KERNEL);
 	dbg_memalloc("%p\n", xd);
 
-	memset(xd, 0, sizeof(struct jffs2_xattr_datum));
 	xd->class = RAWNODE_CLASS_XATTR_DATUM;
 	xd->node = (void *)xd;
 	INIT_LIST_HEAD(&xd->xindex);
@@ -303,10 +302,9 @@ void jffs2_free_xattr_datum(struct jffs2_xattr_datum *xd)
 struct jffs2_xattr_ref *jffs2_alloc_xattr_ref(void)
 {
 	struct jffs2_xattr_ref *ref;
-	ref = kmem_cache_alloc(xattr_ref_cache, GFP_KERNEL);
+	ref = kmem_cache_zalloc(xattr_ref_cache, GFP_KERNEL);
 	dbg_memalloc("%p\n", ref);
 
-	memset(ref, 0, sizeof(struct jffs2_xattr_ref));
 	ref->class = RAWNODE_CLASS_XATTR_REF;
 	ref->node = (void *)ref;
 	return ref;



More information about the linux-mtd-cvs mailing list