linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] inotify: Fix error return code assignment flow.
@ 2020-04-26 14:33 youngjun
  2020-04-27 10:15 ` Jan Kara
  0 siblings, 1 reply; 2+ messages in thread
From: youngjun @ 2020-04-26 14:33 UTC (permalink / raw)
  To: Jan Kara; +Cc: Amir Goldstein, linux-fsdevel, linux-kernel, youngjun

If error code is initialized -EINVAL, there is no need to assign -EINVAL.

Signed-off-by: youngjun <her0gyugyu@gmail.com>
---
 fs/notify/inotify/inotify_user.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
index 81ffc8629fc4..f88bbcc9efeb 100644
--- a/fs/notify/inotify/inotify_user.c
+++ b/fs/notify/inotify/inotify_user.c
@@ -764,20 +764,18 @@ SYSCALL_DEFINE2(inotify_rm_watch, int, fd, __s32, wd)
 	struct fsnotify_group *group;
 	struct inotify_inode_mark *i_mark;
 	struct fd f;
-	int ret = 0;
+	int ret = -EINVAL;
 
 	f = fdget(fd);
 	if (unlikely(!f.file))
 		return -EBADF;
 
 	/* verify that this is indeed an inotify instance */
-	ret = -EINVAL;
 	if (unlikely(f.file->f_op != &inotify_fops))
 		goto out;
 
 	group = f.file->private_data;
 
-	ret = -EINVAL;
 	i_mark = inotify_idr_find(group, wd);
 	if (unlikely(!i_mark))
 		goto out;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] inotify: Fix error return code assignment flow.
  2020-04-26 14:33 [PATCH] inotify: Fix error return code assignment flow youngjun
@ 2020-04-27 10:15 ` Jan Kara
  0 siblings, 0 replies; 2+ messages in thread
From: Jan Kara @ 2020-04-27 10:15 UTC (permalink / raw)
  To: youngjun; +Cc: Jan Kara, Amir Goldstein, linux-fsdevel, linux-kernel

On Sun 26-04-20 07:33:16, youngjun wrote:
> If error code is initialized -EINVAL, there is no need to assign -EINVAL.
> 
> Signed-off-by: youngjun <her0gyugyu@gmail.com>

Thanks. I've added the cleanup to my tree,

								Honza

> ---
>  fs/notify/inotify/inotify_user.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
> index 81ffc8629fc4..f88bbcc9efeb 100644
> --- a/fs/notify/inotify/inotify_user.c
> +++ b/fs/notify/inotify/inotify_user.c
> @@ -764,20 +764,18 @@ SYSCALL_DEFINE2(inotify_rm_watch, int, fd, __s32, wd)
>  	struct fsnotify_group *group;
>  	struct inotify_inode_mark *i_mark;
>  	struct fd f;
> -	int ret = 0;
> +	int ret = -EINVAL;
>  
>  	f = fdget(fd);
>  	if (unlikely(!f.file))
>  		return -EBADF;
>  
>  	/* verify that this is indeed an inotify instance */
> -	ret = -EINVAL;
>  	if (unlikely(f.file->f_op != &inotify_fops))
>  		goto out;
>  
>  	group = f.file->private_data;
>  
> -	ret = -EINVAL;
>  	i_mark = inotify_idr_find(group, wd);
>  	if (unlikely(!i_mark))
>  		goto out;
> -- 
> 2.17.1
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-04-27 10:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-26 14:33 [PATCH] inotify: Fix error return code assignment flow youngjun
2020-04-27 10:15 ` Jan Kara

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).