Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1226782 > unrolled thread

Re: [PATCH] usb: gadget: uvc: fix returnvar.cocci warnings

Started byJulia Lawall <julia.lawall@lip6.fr>
First post2015-09-17 11:00 +0200
Last post2015-09-17 13:40 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH] usb: gadget: uvc: fix returnvar.cocci warnings Julia Lawall <julia.lawall@lip6.fr> - 2015-09-17 11:00 +0200
    Re: [PATCH] usb: gadget: uvc: fix returnvar.cocci warnings Andrzej Pietrasiewicz <andrzej.p@samsung.com> - 2015-09-17 13:20 +0200
      Re: [PATCH] usb: gadget: uvc: fix returnvar.cocci warnings SF Markus Elfring <elfring@users.sourceforge.net> - 2015-09-17 13:40 +0200

#1226782 — Re: [PATCH] usb: gadget: uvc: fix returnvar.cocci warnings

FromJulia Lawall <julia.lawall@lip6.fr>
Date2015-09-17 11:00 +0200
SubjectRe: [PATCH] usb: gadget: uvc: fix returnvar.cocci warnings
Message-ID<q9DcT-6QA-23@gated-at.bofh.it>
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 <andrzej.p@samsung.com>
> CC: kbuild-all@01.org
> CC: Felipe Balbi <balbi@ti.com>
> CC: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> CC: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>
> 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 <andrzej.p@samsung.com>
> Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
> ---
>
> 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;
>
>  }
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1226920

FromAndrzej Pietrasiewicz <andrzej.p@samsung.com>
Date2015-09-17 13:20 +0200
Message-ID<q9Fom-1Tl-11@gated-at.bofh.it>
In reply to#1226782
Hi Julia,

W dniu 17.09.2015 o 10:57, Julia Lawall pisze:
> Coccinelle suggests the following patch.  But the code is curious.  Is the
> function expected to always return a failure value?
>

Thank you for catching this. The function is not expected to always
return a failure value. Fortunately it does not matter anyway because
the return value of the drop_link() operation is silently ignored by
its caller in fs/configfs/symlink.c, functions configfs_symlink()
and configfs_unlink(). For my comments see inline.

> thanks,
> julia
>
> On Thu, 17 Sep 2015, kbuild test robot wrote:
>
>> TO: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
>> CC: kbuild-all@01.org
>> CC: Felipe Balbi <balbi@ti.com>
>> CC: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
>> CC: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>
>> 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 <andrzej.p@samsung.com>
>> Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
>> ---
>>
>> 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;

return 0;


Thanks,

AP
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1226929

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2015-09-17 13:40 +0200
Message-ID<q9FHH-2gj-7@gated-at.bofh.it>
In reply to#1226920
> Fortunately it does not matter anyway because the return value
> of the drop_link() operation is silently ignored by its caller in
> fs/configfs/symlink.c, functions configfs_symlink() and configfs_unlink().

Should such an implementation detail be also reconsidered once more?

Regards,
Markus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web