lkml.org 
[lkml]   [2021]   [Jun]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] kernfs: Simplify if--else codes
On Sun, Jun 27, 2021 at 11:01:55PM -0700, 13145886936@163.com wrote:
> From: gushengxian <gushengxian@yulong.com>
>
> Simplify if--else codes.
>
> Signed-off-by: gushengxian <13145886936@163.com>
> Signed-off-by: gushengxian <gushengxian@yulong.com>
> ---
> fs/kernfs/file.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/fs/kernfs/file.c b/fs/kernfs/file.c
> index c75719312147..6bd531419f30 100644
> --- a/fs/kernfs/file.c
> +++ b/fs/kernfs/file.c
> @@ -644,10 +644,7 @@ static int kernfs_fop_open(struct inode *inode, struct file *file)
> * Both paths of the branch look the same. They're supposed to
> * look that way and give @of->mutex different static lockdep keys.
> */
> - if (has_mmap)
> - mutex_init(&of->mutex);
> - else
> - mutex_init(&of->mutex);
> + mutex_init(&of->mutex);

Please always read the code, and the comments, you are modifying before
you modify it :(

This is a sign you are doing "blind" code cleanups. Please stick with
drivers/staging/ for now as that part of the kernel accepts them much
easier than the rest of the kernel does.

thanks,

greg k-h

\
 
 \ /
  Last update: 2021-06-28 08:47    [W:0.235 / U:0.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site