From: Johan Hovold <johan@kernel.org>
To: Colin King <colin.king@canonical.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-usb@vger.kernel.org, kernel-janitors@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] USB: serial: iuu_phoenix: remove redundant variable 'error'
Date: Thu, 1 Apr 2021 10:01:31 +0200 [thread overview]
Message-ID: <YGV923BQBelY1vnu@hovoldconsulting.com> (raw)
In-Reply-To: <20210327232744.26237-1-colin.king@canonical.com>
On Sat, Mar 27, 2021 at 11:27:44PM +0000, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> The variable error is initialized to 0 and is set to 1 this
> value is never read as it is on an immediate return path. The
> only read of error is to check it is 0 and this check is always
> true at that point of the code. The variable is redundant and
> can be removed.
>
> Addresses-Coverity: ("Unused value")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> drivers/usb/serial/iuu_phoenix.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/usb/serial/iuu_phoenix.c b/drivers/usb/serial/iuu_phoenix.c
> index 093afd67a664..19753611e7b0 100644
> --- a/drivers/usb/serial/iuu_phoenix.c
> +++ b/drivers/usb/serial/iuu_phoenix.c
> @@ -643,7 +643,6 @@ static void iuu_uart_read_callback(struct urb *urb)
> struct iuu_private *priv = usb_get_serial_port_data(port);
> unsigned long flags;
> int status = urb->status;
> - int error = 0;
> int len = 0;
> unsigned char *data = urb->transfer_buffer;
> priv->poll++;
> @@ -660,12 +659,11 @@ static void iuu_uart_read_callback(struct urb *urb)
> if (urb->actual_length > 1) {
> dev_dbg(&port->dev, "%s - urb->actual_length = %i\n", __func__,
> urb->actual_length);
> - error = 1;
> return;
Heh, I guess the author at some point intended not return here, but who
knows. The rest of this function is about as esoteric.
> }
> /* if len > 0 call readbuf */
>
> - if (len > 0 && error == 0) {
> + if (len > 0) {
> dev_dbg(&port->dev, "%s - call read buf - len to read is %i\n",
> __func__, len);
> status = iuu_read_buf(port, len);
Now applied, thanks.
Johan
prev parent reply other threads:[~2021-04-01 8:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-27 23:27 Colin King
2021-04-01 8:01 ` 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=YGV923BQBelY1vnu@hovoldconsulting.com \
--to=johan@kernel.org \
--cc=colin.king@canonical.com \
--cc=gregkh@linuxfoundation.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@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
all inboxes | Powered by JetHome®