From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754468AbbIQI6F (ORCPT ); Thu, 17 Sep 2015 04:58:05 -0400 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]:58090 "EHLO mail3-relais-sop.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754138AbbIQI6C (ORCPT ); Thu, 17 Sep 2015 04:58:02 -0400 X-IronPort-AV: E=Sophos;i="5.17,545,1437429600"; d="scan'208";a="147580617" Date: Thu, 17 Sep 2015 10:57:59 +0200 (CEST) From: Julia Lawall X-X-Sender: jll@hadrien To: Andrzej Pietrasiewicz cc: kbuild-all@01.org, Felipe Balbi , Laurent Pinchart , Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] usb: gadget: uvc: fix returnvar.cocci warnings In-Reply-To: <20150917000130.GA25134@lkp-ib04> Message-ID: References: <201509170828.xv0cYNA5%fengguang.wu@intel.com> <20150917000130.GA25134@lkp-ib04> User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) 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 Coccinelle suggests the following patch. But the code is curious. Is the function expected to always return a failure value? thanks, julia On Thu, 17 Sep 2015, kbuild test robot wrote: > TO: Andrzej Pietrasiewicz > CC: kbuild-all@01.org > CC: Felipe Balbi > CC: Laurent Pinchart > CC: "Greg Kroah-Hartman" > CC: linux-usb@vger.kernel.org > CC: linux-kernel@vger.kernel.org > > drivers/usb/gadget/function/uvc_configfs.c:866:5-8: Unneeded variable: "ret". Return "- EINVAL" on line 891 > > > Remove unneeded variable used to store return value. > > Generated by: scripts/coccinelle/misc/returnvar.cocci > > CC: Andrzej Pietrasiewicz > Signed-off-by: Fengguang Wu > --- > > Please take the patch only if it's a positive warning. Thanks! > > uvc_configfs.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > --- a/drivers/usb/gadget/function/uvc_configfs.c > +++ b/drivers/usb/gadget/function/uvc_configfs.c > @@ -863,7 +863,6 @@ static int uvcg_streaming_header_drop_li > struct uvcg_streaming_header *src_hdr; > struct uvcg_format *target_fmt = NULL; > struct uvcg_format_ptr *format_ptr, *tmp; > - int ret = -EINVAL; > > src_hdr = to_uvcg_streaming_header(src); > mutex_lock(su_mutex); /* for navigating configfs hierarchy */ > @@ -888,7 +887,7 @@ static int uvcg_streaming_header_drop_li > out: > mutex_unlock(&opts->lock); > mutex_unlock(su_mutex); > - return ret; > + return -EINVAL; > > } > >