* [PATCH -next] 9p: Remove unneeded cast from memory allocation
@ 2020-07-29 8:59 Li Heng
2020-07-31 5:24 ` Dominique Martinet
0 siblings, 1 reply; 2+ messages in thread
From: Li Heng @ 2020-07-29 8:59 UTC (permalink / raw)
To: ericvh, lucho, asmadeus; +Cc: v9fs-developer, linux-kernel
Remove casting the values returned by memory allocation function.
Coccinelle emits WARNING:
./fs/9p/vfs_inode.c:226:12-29: WARNING: casting value returned by memory allocation function to (struct v9fs_inode *) is useless.
Signed-off-by: Li Heng <liheng40@huawei.com>
---
fs/9p/vfs_inode.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index 0fd5bf2..ae0c38a 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -223,8 +223,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
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH -next] 9p: Remove unneeded cast from memory allocation
2020-07-29 8:59 [PATCH -next] 9p: Remove unneeded cast from memory allocation Li Heng
@ 2020-07-31 5:24 ` Dominique Martinet
0 siblings, 0 replies; 2+ messages in thread
From: Dominique Martinet @ 2020-07-31 5:24 UTC (permalink / raw)
To: Li Heng; +Cc: ericvh, lucho, v9fs-developer, linux-kernel
Li Heng wrote on Wed, Jul 29, 2020:
> Remove casting the values returned by memory allocation function.
>
> Coccinelle emits WARNING:
>
> ./fs/9p/vfs_inode.c:226:12-29: WARNING: casting value returned by memory allocation function to (struct v9fs_inode *) is useless.
>
> Signed-off-by: Li Heng <liheng40@huawei.com>
Why not, I'll take this for next.
Please pay a bit more attention to the commit message next time though,
neither "Remove casting the values" nor "x emits warning" are proper
English -- I've taken the liberty to fix the grammar a bit...
> ---
> fs/9p/vfs_inode.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
> index 0fd5bf2..ae0c38a 100644
> --- a/fs/9p/vfs_inode.c
> +++ b/fs/9p/vfs_inode.c
> @@ -223,8 +223,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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-07-31 5:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-29 8:59 [PATCH -next] 9p: Remove unneeded cast from memory allocation Li Heng
2020-07-31 5:24 ` Dominique Martinet
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.