From: Felipe Balbi <felipe.balbi@linux.intel.com>
To: Colin King <colin.king@canonical.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Peter Chen <peter.chen@nxp.com>,
Alan Stern <stern@rowland.harvard.edu>,
Mathias Nyman <mathias.nyman@linux.intel.com>,
Lu Baolu <baolu.lu@linux.intel.com>,
Chunfeng Yun <chunfeng.yun@mediatek.com>,
linux-usb@vger.kernel.org
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] usb: misc: usbtest: remove redundant check on retval < 0
Date: Mon, 13 Feb 2017 10:45:19 +0000 [thread overview]
Message-ID: <8760keqshs.fsf@linux.intel.com> (raw)
In-Reply-To: <20170212183518.22528-1-colin.king@canonical.com>
[-- Attachment #1: Type: text/plain, Size: 1028 bytes --]
Hi,
Colin King <colin.king@canonical.com> writes:
> From: Colin Ian King <colin.king@canonical.com>
>
> The check for retval being less than zero is always true since
> retval equal to -EPIPE at that point. Replace the existing
> conditional with just return retval.
>
> Detected with CoverityScan, CID#114349 ("Logically dead code")
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> drivers/usb/misc/usbtest.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c
> index 3525626..17c0810 100644
> --- a/drivers/usb/misc/usbtest.c
> +++ b/drivers/usb/misc/usbtest.c
> @@ -992,7 +992,7 @@ static int ch9_postconfig(struct usbtest_dev *dev)
> dev_err(&iface->dev,
> "hs dev qualifier --> %d\n",
> retval);
> - return (retval < 0) ? retval : -EDOM;
> + return retval;
you're changing return value here, are you sure there's nothing else
depending on this error?
--
balbi
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
next prev parent reply other threads:[~2017-02-13 10:45 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-12 18:35 [PATCH] usb: misc: usbtest: remove redundant check on retval < 0 Colin King
2017-02-13 9:49 ` Peter Chen
2017-02-13 10:45 ` Felipe Balbi [this message]
2017-02-13 16:44 ` Colin Ian King
2017-02-13 16:45 ` Alan Stern
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=8760keqshs.fsf@linux.intel.com \
--to=felipe.balbi@linux.intel.com \
--cc=baolu.lu@linux.intel.com \
--cc=chunfeng.yun@mediatek.com \
--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 \
--cc=mathias.nyman@linux.intel.com \
--cc=peter.chen@nxp.com \
--cc=stern@rowland.harvard.edu \
/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