diff mbox

procfs: Remove unnecessary cast in alloc codes

Message ID 1429780279-5621-1-git-send-email-firogm@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Firo Yang April 23, 2015, 9:11 a.m. UTC
Remove unnecessary cast of allocation return value in
fs/proc/inode.c::proc_alloc_inode().

Signed-off-by: Firo Yang <firogm@gmail.com>
---
 fs/proc/inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Richard Weinberger April 23, 2015, 11:39 a.m. UTC | #1
On Thu, Apr 23, 2015 at 11:11 AM, Firo Yang <firogm@gmail.com> wrote:
> Remove unnecessary cast of allocation return value in
> fs/proc/inode.c::proc_alloc_inode().
>
> Signed-off-by: Firo Yang <firogm@gmail.com>
> ---
>  fs/proc/inode.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/proc/inode.c b/fs/proc/inode.c
> index 7697b66..08a7235 100644
> --- a/fs/proc/inode.c
> +++ b/fs/proc/inode.c
> @@ -58,7 +58,7 @@ static struct inode *proc_alloc_inode(struct super_block *sb)
>         struct proc_inode *ei;
>         struct inode *inode;
>
> -       ei = (struct proc_inode *)kmem_cache_alloc(proc_inode_cachep, GFP_KERNEL);
> +       ei = kmem_cache_alloc(proc_inode_cachep, GFP_KERNEL);

It is not really unnecessary for at lest two reasons.
- If the type of "ei" changes gcc will emit a warning
- It is grep friendly

At the end of the day it is a matter of taste. :-)
diff mbox

Patch

diff --git a/fs/proc/inode.c b/fs/proc/inode.c
index 7697b66..08a7235 100644
--- a/fs/proc/inode.c
+++ b/fs/proc/inode.c
@@ -58,7 +58,7 @@  static struct inode *proc_alloc_inode(struct super_block *sb)
 	struct proc_inode *ei;
 	struct inode *inode;
 
-	ei = (struct proc_inode *)kmem_cache_alloc(proc_inode_cachep, GFP_KERNEL);
+	ei = kmem_cache_alloc(proc_inode_cachep, GFP_KERNEL);
 	if (!ei)
 		return NULL;
 	ei->pid = NULL;