From: Colin Ian King <colin.king@canonical.com>
To: Felipe Balbi <felipe.balbi@linux.intel.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 16:44:06 +0000 [thread overview]
Message-ID: <ffc33c9f-191a-d19c-8aaa-b18519dd25af@canonical.com> (raw)
In-Reply-To: <8760keqshs.fsf@linux.intel.com>
[-- Attachment #1.1: Type: text/plain, Size: 1344 bytes --]
On 13/02/17 10:45, Felipe Balbi wrote:
>
> 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?
>
The code in the current state will never return -EDOM and will always
return retval, so this change actually makes no functional change, it
just removes a redundant check. So it's not going to make a jot of
difference to the current behaver.
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 837 bytes --]
next prev parent reply other threads:[~2017-02-13 16:45 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-12 18:35 Colin King
2017-02-13 9:49 ` Peter Chen
2017-02-13 10:45 ` Felipe Balbi
2017-02-13 16:44 ` Colin Ian King [this message]
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=ffc33c9f-191a-d19c-8aaa-b18519dd25af@canonical.com \
--to=colin.king@canonical.com \
--cc=baolu.lu@linux.intel.com \
--cc=chunfeng.yun@mediatek.com \
--cc=felipe.balbi@linux.intel.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
all inboxes | Powered by JetHome®