Skip to contentSkip to conversation

fs/9p: Remove cast from memory allocation

PATCH In review Tobin C. Harding 2 participants 2 messages Feb 22, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fs/9p: Remove cast from memory allocation

Coccinelle emits WARNING: casting value returned by memory allocation function to (struct v9fs_inode *) is useless.

Remove unnecessary cast.

---
 fs/9p/vfs_inode.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
fs/9p/vfs_inode.c +1 -2
index f4f4450..462e9e4 100644
@@ -238,8 +238,7 @@ v9fs_blank_wstat(struct p9_wstat *wstat)
 struct inode *v9fs_alloc_inode(struct super_block *sb)
 {
 	struct v9fs_inode *v9inode;
-	v9inode = (struct v9fs_inode *)kmem_cache_alloc(v9fs_inode_cache,
-							GFP_KERNEL);
+	v9inode = kmem_cache_alloc(v9fs_inode_cache, GFP_KERNEL);
 	if (!v9inode)
 		return NULL;
 #ifdef CONFIG_9P_FSCACHE
Signature · 1 line
2.7.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · On Wed, 22 Feb 2017 17:34:13 +1100 "Tobin C. Harding" <[email protected]> wrote:

Coccinelle emits WARNING: casting value returned by memory allocation function to (struct v9fs_inode *) is useless.

Remove unnecessary cast.

---

Quoted 17 lines
 fs/9p/vfs_inode.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
fs/9p/vfs_inode.c +1 -2
index f4f4450..462e9e4 100644
@@ -238,8 +238,7 @@ v9fs_blank_wstat(struct p9_wstat *wstat)
 struct inode *v9fs_alloc_inode(struct super_block *sb)
 {
 	struct v9fs_inode *v9inode;
-	v9inode = (struct v9fs_inode *)kmem_cache_alloc(v9fs_inode_cache,
-							GFP_KERNEL);
+	v9inode = kmem_cache_alloc(v9fs_inode_cache, GFP_KERNEL);
 	if (!v9inode)
 		return NULL;
 #ifdef CONFIG_9P_FSCACHE