All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: 13145886936@163.com
Cc: tj@kernel.org, linux-kernel@vger.kernel.org,
	gushengxian <gushengxian@yulong.com>
Subject: Re: [PATCH] kernfs: Simplify if--else codes
Date: Mon, 28 Jun 2021 08:47:41 +0200	[thread overview]
Message-ID: <YNlwjchu6QMVpc6g@kroah.com> (raw)
In-Reply-To: <20210628060155.1509993-1-13145886936@163.com>

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

           reply	other threads:[~2021-06-28  6:47 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <20210628060155.1509993-1-13145886936@163.com>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YNlwjchu6QMVpc6g@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=13145886936@163.com \
    --cc=gushengxian@yulong.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.