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


Groups > linux.kernel > #1445779 > unrolled thread

Re: [PATCH] IPC-mqueue: Delete unnecessary checks before two function calls

Started bySF Markus Elfring <elfring@users.sourceforge.net>
First post2016-07-18 21:50 +0200
Last post2016-07-18 21:50 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH] IPC-mqueue: Delete unnecessary checks before two function  calls SF Markus Elfring <elfring@users.sourceforge.net> - 2016-07-18 21:50 +0200

#1445779 — Re: [PATCH] IPC-mqueue: Delete unnecessary checks before two function calls

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2016-07-18 21:50 +0200
SubjectRe: [PATCH] IPC-mqueue: Delete unnecessary checks before two function calls
Message-ID<rWmIa-233-13@gated-at.bofh.it>
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Thu, 5 Nov 2015 17:55:25 +0100
> 
> The functions iput() and unregister_sysctl_table() test whether their
> argument is NULL and then return immediately.
> Thus the tests around their calls are not needed.
> 
> This issue was detected by using the Coccinelle software.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  ipc/mqueue.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/ipc/mqueue.c b/ipc/mqueue.c
> index 161a180..ade9dd8 100644
> --- a/ipc/mqueue.c
> +++ b/ipc/mqueue.c
> @@ -885,8 +885,7 @@ SYSCALL_DEFINE1(mq_unlink, const char __user *, u_name)
>  
>  out_unlock:
>  	mutex_unlock(&d_inode(mnt->mnt_root)->i_mutex);
> -	if (inode)
> -		iput(inode);
> +	iput(inode);
>  	mnt_drop_write(mnt);
>  out_name:
>  	putname(name);
> @@ -1460,8 +1459,7 @@ static int __init init_mqueue_fs(void)
>  out_filesystem:
>  	unregister_filesystem(&mqueue_fs_type);
>  out_sysctl:
> -	if (mq_sysctl_table)
> -		unregister_sysctl_table(mq_sysctl_table);
> +	unregister_sysctl_table(mq_sysctl_table);
>  	kmem_cache_destroy(mqueue_inode_cachep);
>  	return error;
>  }
> 

How do you think about to integrate this update suggestion
into another source code repository?

Regards,
Markus

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web