lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YKTWUmYkC/qfrLh0@hovoldconsulting.com>
Date:   Wed, 19 May 2021 11:11:46 +0200
From:   Johan Hovold <johan@...nel.org>
To:     Jiri Slaby <jslaby@...e.cz>
Cc:     gregkh@...uxfoundation.org, linux-serial@...r.kernel.org,
        linux-kernel@...r.kernel.org, linux-usb@...r.kernel.org
Subject: Re: [PATCH 29/35] USB: serial: digi_acceleport, simplify
 digi_chars_in_buffer

On Wed, May 05, 2021 at 11:19:22AM +0200, Jiri Slaby wrote:
> "if"'s true branch in digi_chars_in_buffer returns. So there is no need
> for "else" and indented code. Remove this else and shift the code to the
> left.
> 
> Signed-off-by: Jiri Slaby <jslaby@...e.cz>
> Cc: Johan Hovold <johan@...nel.org>
> Cc: linux-usb@...r.kernel.org
> ---
>  drivers/usb/serial/digi_acceleport.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c
> index 19ee8191647c..0c4d611621c2 100644
> --- a/drivers/usb/serial/digi_acceleport.c
> +++ b/drivers/usb/serial/digi_acceleport.c
> @@ -1050,12 +1050,11 @@ static unsigned int digi_chars_in_buffer(struct tty_struct *tty)
>  			priv->dp_port_num, port->bulk_out_size - 2);
>  		/* return(port->bulk_out_size - 2); */
>  		return 256;
> -	} else {
> -		dev_dbg(&port->dev, "digi_chars_in_buffer: port=%d, chars=%d\n",
> -			priv->dp_port_num, priv->dp_out_buf_len);
> -		return priv->dp_out_buf_len;
>  	}
>  
> +	dev_dbg(&port->dev, "digi_chars_in_buffer: port=%d, chars=%d\n",
> +		priv->dp_port_num, priv->dp_out_buf_len);
> +	return priv->dp_out_buf_len;
>  }

This doesn't look like much of an improvement so I'm dropping this one.

If we want to clean this up we should use a common exit path for both
branches. I'll send a couple of patches to address this and a related
issue.

Johan

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ