From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752330AbdBMQpd (ORCPT ); Mon, 13 Feb 2017 11:45:33 -0500 Received: from iolanthe.rowland.org ([192.131.102.54]:44724 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1752020AbdBMQpc (ORCPT ); Mon, 13 Feb 2017 11:45:32 -0500 Date: Mon, 13 Feb 2017 11:45:31 -0500 (EST) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: Felipe Balbi cc: Colin King , Greg Kroah-Hartman , Peter Chen , Mathias Nyman , Lu Baolu , Chunfeng Yun , , , Subject: Re: [PATCH] usb: misc: usbtest: remove redundant check on retval < 0 In-Reply-To: <8760keqshs.fsf@linux.intel.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 13 Feb 2017, Felipe Balbi wrote: > Hi, > > Colin King writes: > > From: Colin Ian King > > > > 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 > > --- > > 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? I bet you didn't look at the original code. :-) Just before the start of the patch there is: if (retval == -EPIPE) { ... So no, the patch does not change the return value. Alan Stern From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alan Stern Date: Mon, 13 Feb 2017 16:45:31 +0000 Subject: Re: [PATCH] usb: misc: usbtest: remove redundant check on retval < 0 Message-Id: List-Id: In-Reply-To: <8760keqshs.fsf@linux.intel.com> References: <20170212183518.22528-1-colin.king@canonical.com> In-Reply-To: <20170212183518.22528-1-colin.king@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Felipe Balbi Cc: Colin King , Greg Kroah-Hartman , Peter Chen , Mathias Nyman , Lu Baolu , Chunfeng Yun , linux-usb@vger.kernel.org, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org On Mon, 13 Feb 2017, Felipe Balbi wrote: > Hi, > > Colin King writes: > > From: Colin Ian King > > > > 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 > > --- > > 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? I bet you didn't look at the original code. :-) Just before the start of the patch there is: if (retval = -EPIPE) { ... So no, the patch does not change the return value. Alan Stern