Linux Serial subsystem development
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Colin Ian King <colin.king@canonical.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jirislaby@kernel.org>,
	Lee Jones <lee.jones@linaro.org>,
	linux-serial@vger.kernel.org, kernel-janitors@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH][next] tty: serial: jsm: remove redundant assignments of several variables
Date: Thu, 22 Apr 2021 14:56:21 +0200	[thread overview]
Message-ID: <YIFydeoE/WRfPcvA@hovoldconsulting.com> (raw)
In-Reply-To: <c9497e47-cdfb-7be0-ad35-648ea5d68268@canonical.com>

On Thu, Apr 22, 2021 at 01:53:03PM +0100, Colin Ian King wrote:
> On 22/04/2021 13:52, Johan Hovold wrote:
> > On Thu, Apr 22, 2021 at 01:11:15PM +0100, Colin King wrote:
> >> From: Colin Ian King <colin.king@canonical.com>
> >>
> >> Several variables are being assigned with values that are never
> >> read and being updated later with a new value. The initializations
> >> are redundant and can be removed.
> >>
> >> Addresses-Coverity: ("Unused value")
> >> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> >> ---
> >>  drivers/tty/serial/jsm/jsm_cls.c | 6 ++----
> >>  1 file changed, 2 insertions(+), 4 deletions(-)
> >>
> >> diff --git a/drivers/tty/serial/jsm/jsm_cls.c b/drivers/tty/serial/jsm/jsm_cls.c
> >> index b507a2cec926..b58ea4344aaf 100644
> >> --- a/drivers/tty/serial/jsm/jsm_cls.c
> >> +++ b/drivers/tty/serial/jsm/jsm_cls.c
> >> @@ -349,8 +349,8 @@ static void cls_assert_modem_signals(struct jsm_channel *ch)
> >>  
> >>  static void cls_copy_data_from_uart_to_queue(struct jsm_channel *ch)
> >>  {
> >> -	int qleft = 0;
> >> -	u8 linestatus = 0;
> >> +	int qleft;
> >> +	u8 linestatus;
> >>  	u8 error_mask = 0;
> >>  	u16 head;
> >>  	u16 tail;
> >> @@ -365,8 +365,6 @@ static void cls_copy_data_from_uart_to_queue(struct jsm_channel *ch)
> >>  	head = ch->ch_r_head & RQUEUEMASK;
> >>  	tail = ch->ch_r_tail & RQUEUEMASK;
> >>  
> >> -	/* Get our cached LSR */
> >> -	linestatus = ch->ch_cached_lsr;
> >>  	ch->ch_cached_lsr = 0;
> > 
> > Why leave this assignment in? Looks like this was all copy-pasta, but
> > this assignment makes even less sense now that you remove the comment
> > and load.
> 
> Which assignment are you referring to?

The one just above my comment: 

	ch->ch_cached_lsr = 0;

Johan

  reply	other threads:[~2021-04-22 12:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-22 12:11 [PATCH][next] tty: serial: jsm: remove redundant assignments of several variables Colin King
2021-04-22 12:52 ` Johan Hovold
2021-04-22 12:53   ` Colin Ian King
2021-04-22 12:56     ` Johan Hovold [this message]
2021-04-22 13:01       ` Colin Ian King
2021-04-22 13:15         ` Johan Hovold

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=YIFydeoE/WRfPcvA@hovoldconsulting.com \
    --to=johan@kernel.org \
    --cc=colin.king@canonical.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=lee.jones@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@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