linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Salah Triki <salah.triki@gmail.com>
Cc: Keith Packard <keithp@keithp.com>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] usb: misc: chaoskey: remove useless else
Date: Sat, 14 Aug 2021 08:34:54 +0200	[thread overview]
Message-ID: <YRdkDvF+BhGsKakD@kroah.com> (raw)
In-Reply-To: <20210813164049.GA2310720@pc>

On Fri, Aug 13, 2021 at 05:40:49PM +0100, Salah Triki wrote:
> Remove useless else in order to make the code cleaner.
> 
> Signed-off-by: Salah Triki <salah.triki@gmail.com>
> ---
>  drivers/usb/misc/chaoskey.c | 11 ++++-------
>  1 file changed, 4 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/usb/misc/chaoskey.c b/drivers/usb/misc/chaoskey.c
> index 87067c3d6109..9814ac2201d5 100644
> --- a/drivers/usb/misc/chaoskey.c
> +++ b/drivers/usb/misc/chaoskey.c
> @@ -299,14 +299,11 @@ static int chaoskey_release(struct inode *inode, struct file *file)
>  
>  	--dev->open;
>  
> -	if (!dev->present) {
> -		if (dev->open == 0) {
> -			mutex_unlock(&dev->lock);
> +	mutex_unlock(&dev->lock);
> +
> +	if (!dev->present)
> +		if (dev->open == 0)
>  			chaoskey_free(dev);
> -		} else
> -			mutex_unlock(&dev->lock);
> -	} else
> -		mutex_unlock(&dev->lock);
>  
>  	usb_dbg(interface, "release success");
>  	return 0;
> -- 
> 2.25.1
> 

Please fix whatever tool "found" this code to be changed so that it does
not introduce bugs again, that's a broken tool.

thanks,

greg k-h

      parent reply	other threads:[~2021-08-14  6:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-13 16:40 [PATCH] usb: misc: chaoskey: remove useless else Salah Triki
2021-08-13 17:38 ` Keith Packard
2021-08-14  6:34 ` Greg Kroah-Hartman [this message]

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=YRdkDvF+BhGsKakD@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=keithp@keithp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=salah.triki@gmail.com \
    /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 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).