Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1736401

[PATCH 3/4] VFS: normal filesystems (and lustre): Cocci spatch "alloc_cast"

From Thomas Meyer <thomas@m3y3r.de>
Newsgroups linux.kernel
Subject [PATCH 3/4] VFS: normal filesystems (and lustre): Cocci spatch "alloc_cast"
Date 2017-09-21 08:50 +0200
Message-ID <us3t7-5H4-9@gated-at.bofh.it> (permalink)
References <us3t7-5H4-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Remove casting the values returned by memory allocation functions like
kmalloc, kzalloc, kmem_cache_alloc, kmem_cache_zalloc etc."
Found by coccinelle spatch "api/alloc/alloc_cast.cocci"

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
---

diff -u -p a/fs/ncpfs/inode.c b/fs/ncpfs/inode.c
--- a/fs/ncpfs/inode.c
+++ b/fs/ncpfs/inode.c
@@ -53,7 +53,7 @@ static struct kmem_cache * ncp_inode_cac
 static struct inode *ncp_alloc_inode(struct super_block *sb)
 {
 	struct ncp_inode_info *ei;
-	ei = (struct ncp_inode_info *)kmem_cache_alloc(ncp_inode_cachep, GFP_KERNEL);
+	ei = kmem_cache_alloc(ncp_inode_cachep, GFP_KERNEL);
 	if (!ei)
 		return NULL;
 	return &ei->vfs_inode;

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH 3/4] VFS: normal filesystems (and lustre): Cocci spatch  "alloc_cast" Thomas Meyer <thomas@m3y3r.de> - 2017-09-21 08:50 +0200

csiph-web