linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Jiri Slaby <jslaby@suse.cz>
Cc: gregkh@linuxfoundation.org, linux-serial@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org
Subject: Re: [PATCH 29/35] USB: serial: digi_acceleport, simplify digi_chars_in_buffer
Date: Wed, 19 May 2021 11:11:46 +0200	[thread overview]
Message-ID: <YKTWUmYkC/qfrLh0@hovoldconsulting.com> (raw)
In-Reply-To: <20210505091928.22010-30-jslaby@suse.cz>

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@suse.cz>
> Cc: Johan Hovold <johan@kernel.org>
> Cc: linux-usb@vger.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

      reply	other threads:[~2021-05-19  9:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210505091928.22010-1-jslaby@suse.cz>
2021-05-05  9:19 ` [PATCH 23/35] USB: serial: make usb_serial_driver::write_room return uint Jiri Slaby
2021-05-19  9:07   ` Johan Hovold
2021-05-05  9:19 ` [PATCH 27/35] serial: make usb_serial_driver::chars_in_buffer " Jiri Slaby
2021-05-19  9:09   ` Johan Hovold
2021-05-05  9:19 ` [PATCH 29/35] USB: serial: digi_acceleport, simplify digi_chars_in_buffer Jiri Slaby
2021-05-19  9:11   ` Johan Hovold [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=YKTWUmYkC/qfrLh0@hovoldconsulting.com \
    --to=johan@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=linux-usb@vger.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 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).