diff mbox series

[-next] usb: gadget: Remove dead branch code

Message ID 20190123143136.15704-1-yuehaibing@huawei.com (mailing list archive)
State Mainlined
Commit d7c3eeffbc55ad462e6447902ffa752c7e9d6aae
Headers show
Series [-next] usb: gadget: Remove dead branch code | expand

Commit Message

Yue Haibing Jan. 23, 2019, 2:31 p.m. UTC
'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(-)

Comments

Laurent Pinchart March 6, 2019, 12:46 a.m. UTC | #1
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:									\
diff mbox series

Patch

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:									\