kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] media: uvcvideo: Remove unused variable
@ 2021-04-30 22:18 Nigel Christian
  2021-05-03  9:29 ` Dan Carpenter
  0 siblings, 1 reply; 3+ messages in thread
From: Nigel Christian @ 2021-04-30 22:18 UTC (permalink / raw)
  To: Laurent Pinchart, Mauro Carvalho Chehab; +Cc: linux-media, kernel-janitors

The variable buflen is being assigned a value that is never read,
which can be removed.

Addresses-Coverity: ("Unused value")
Signed-off-by: Nigel Christian <nigel.l.christian@gmail.com>
---
 drivers/media/usb/uvc/uvc_driver.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
index 9a791d8ef200..370b086c6e22 100644
--- a/drivers/media/usb/uvc/uvc_driver.c
+++ b/drivers/media/usb/uvc/uvc_driver.c
@@ -768,7 +768,6 @@ static int uvc_parse_format(struct uvc_device *dev,
 		format->xfer_func = uvc_xfer_func(buffer[4]);
 		format->ycbcr_enc = uvc_ycbcr_enc(buffer[5]);
 
-		buflen -= buffer[0];
 		buffer += buffer[0];
 	}
 
-- 
2.31.1


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

* Re: [PATCH] media: uvcvideo: Remove unused variable
  2021-04-30 22:18 [PATCH] media: uvcvideo: Remove unused variable Nigel Christian
@ 2021-05-03  9:29 ` Dan Carpenter
  2021-05-03 10:07   ` Laurent Pinchart
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2021-05-03  9:29 UTC (permalink / raw)
  To: Nigel Christian
  Cc: Laurent Pinchart, Mauro Carvalho Chehab, linux-media, kernel-janitors

On Fri, Apr 30, 2021 at 06:18:14PM -0400, Nigel Christian wrote:
> The variable buflen is being assigned a value that is never read,
> which can be removed.
> 
> Addresses-Coverity: ("Unused value")
> Signed-off-by: Nigel Christian <nigel.l.christian@gmail.com>
> ---
>  drivers/media/usb/uvc/uvc_driver.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
> index 9a791d8ef200..370b086c6e22 100644
> --- a/drivers/media/usb/uvc/uvc_driver.c
> +++ b/drivers/media/usb/uvc/uvc_driver.c
> @@ -768,7 +768,6 @@ static int uvc_parse_format(struct uvc_device *dev,
>  		format->xfer_func = uvc_xfer_func(buffer[4]);
>  		format->ycbcr_enc = uvc_ycbcr_enc(buffer[5]);
>  
> -		buflen -= buffer[0];
>  		buffer += buffer[0];
>  	}

This is a situation where I think that the unused assignment helps
readability because it shows how buflen and buffer are connected.

regards,
dan carpenter


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

* Re: [PATCH] media: uvcvideo: Remove unused variable
  2021-05-03  9:29 ` Dan Carpenter
@ 2021-05-03 10:07   ` Laurent Pinchart
  0 siblings, 0 replies; 3+ messages in thread
From: Laurent Pinchart @ 2021-05-03 10:07 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Nigel Christian, Mauro Carvalho Chehab, linux-media, kernel-janitors

On Mon, May 03, 2021 at 12:29:24PM +0300, Dan Carpenter wrote:
> On Fri, Apr 30, 2021 at 06:18:14PM -0400, Nigel Christian wrote:
> > The variable buflen is being assigned a value that is never read,
> > which can be removed.
> > 
> > Addresses-Coverity: ("Unused value")
> > Signed-off-by: Nigel Christian <nigel.l.christian@gmail.com>
> > ---
> >  drivers/media/usb/uvc/uvc_driver.c | 1 -
> >  1 file changed, 1 deletion(-)
> > 
> > diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
> > index 9a791d8ef200..370b086c6e22 100644
> > --- a/drivers/media/usb/uvc/uvc_driver.c
> > +++ b/drivers/media/usb/uvc/uvc_driver.c
> > @@ -768,7 +768,6 @@ static int uvc_parse_format(struct uvc_device *dev,
> >  		format->xfer_func = uvc_xfer_func(buffer[4]);
> >  		format->ycbcr_enc = uvc_ycbcr_enc(buffer[5]);
> >  
> > -		buflen -= buffer[0];
> >  		buffer += buffer[0];
> >  	}
> 
> This is a situation where I think that the unused assignment helps
> readability because it shows how buflen and buffer are connected.

And removing it may cause issues later if we end up adding more code
below (unlikely in practice though). I'd rather keep this line.

-- 
Regards,

Laurent Pinchart

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

end of thread, other threads:[~2021-05-03 10:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-30 22:18 [PATCH] media: uvcvideo: Remove unused variable Nigel Christian
2021-05-03  9:29 ` Dan Carpenter
2021-05-03 10:07   ` 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).