linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] usb: gadget: Remove dead branch code
@ 2019-01-23 14:31 YueHaibing
  2019-03-06  0:46 ` Laurent Pinchart
  0 siblings, 1 reply; 2+ messages in thread
From: YueHaibing @ 2019-01-23 14:31 UTC (permalink / raw)
  To: gregkh, laurent.pinchart, balbi; +Cc: linux-kernel, linux-usb, YueHaibing

'num' is a u8 variable, it never greater than 255,
So the if branch is dead code and can be removed.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 drivers/usb/gadget/function/uvc_configfs.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/drivers/usb/gadget/function/uvc_configfs.c b/drivers/usb/gadget/function/uvc_configfs.c
index bc1e2af..8fe85cb 100644
--- a/drivers/usb/gadget/function/uvc_configfs.c
+++ b/drivers/usb/gadget/function/uvc_configfs.c
@@ -1570,10 +1570,6 @@ uvcg_uncompressed_##cname##_store(struct config_item *item,		\
 	if (ret)							\
 		goto end;						\
 									\
-	if (num > 255) {						\
-		ret = -EINVAL;						\
-		goto end;						\
-	}								\
 	u->desc.aname = num;						\
 	ret = len;							\
 end:									\
@@ -1767,10 +1763,6 @@ uvcg_mjpeg_##cname##_store(struct config_item *item,			\
 	if (ret)							\
 		goto end;						\
 									\
-	if (num > 255) {						\
-		ret = -EINVAL;						\
-		goto end;						\
-	}								\
 	u->desc.aname = num;						\
 	ret = len;							\
 end:									\
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH -next] usb: gadget: Remove dead branch code
  2019-01-23 14:31 [PATCH -next] usb: gadget: Remove dead branch code YueHaibing
@ 2019-03-06  0:46 ` Laurent Pinchart
  0 siblings, 0 replies; 2+ messages in thread
From: Laurent Pinchart @ 2019-03-06  0:46 UTC (permalink / raw)
  To: YueHaibing; +Cc: gregkh, balbi, linux-kernel, linux-usb

Hello YueHaibing,

Thank you for the patch.

On Wed, Jan 23, 2019 at 10:31:36PM +0800, YueHaibing wrote:
> 'num' is a u8 variable, it never greater than 255,
> So the if branch is dead code and can be removed.
> 
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  drivers/usb/gadget/function/uvc_configfs.c | 8 --------
>  1 file changed, 8 deletions(-)
> 
> diff --git a/drivers/usb/gadget/function/uvc_configfs.c b/drivers/usb/gadget/function/uvc_configfs.c
> index bc1e2af..8fe85cb 100644
> --- a/drivers/usb/gadget/function/uvc_configfs.c
> +++ b/drivers/usb/gadget/function/uvc_configfs.c
> @@ -1570,10 +1570,6 @@ uvcg_uncompressed_##cname##_store(struct config_item *item,		\
>  	if (ret)							\
>  		goto end;						\
>  									\
> -	if (num > 255) {						\
> -		ret = -EINVAL;						\
> -		goto end;						\
> -	}								\
>  	u->desc.aname = num;						\
>  	ret = len;							\
>  end:									\
> @@ -1767,10 +1763,6 @@ uvcg_mjpeg_##cname##_store(struct config_item *item,			\
>  	if (ret)							\
>  		goto end;						\
>  									\
> -	if (num > 255) {						\
> -		ret = -EINVAL;						\
> -		goto end;						\
> -	}								\
>  	u->desc.aname = num;						\
>  	ret = len;							\
>  end:									\

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-03-06  0:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-23 14:31 [PATCH -next] usb: gadget: Remove dead branch code YueHaibing
2019-03-06  0:46 ` Laurent Pinchart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).