Skip to contentSkip to conversation

media: uvcvideo: Remove unused variable

PATCH In review Nigel Christian 3 participants 3 messages Apr 30, 2021 – May 3, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media: uvcvideo: Remove unused variable

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

Addresses-Coverity: ("Unused value")

---
 drivers/media/usb/uvc/uvc_driver.c | 1 -
 1 file changed, 1 deletion(-)
drivers/media/usb/uvc/uvc_driver.c +0 -1
index 9a791d8ef200..370b086c6e22 100644
@@ -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];
 	}
 
Signature · 1 line
2.31.1
#1 lore raw
Quoted 14 lines · Nigel Christian

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

Addresses-Coverity: ("Unused value")

---
 drivers/media/usb/uvc/uvc_driver.c | 1 -
 1 file changed, 1 deletion(-)
drivers/media/usb/uvc/uvc_driver.c +0 -0
index 9a791d8ef200..370b086c6e22 100644

drivers/media/usb/uvc/uvc_driver.c static int uvc_parse_format(struct uvc_device *dev, · line 772

Quoted 6 lines
drivers/media/usb/uvc/uvc_driver.c +0 -1
@@ -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

maintainer
#2 lore raw
Quoted 18 lines · Dan Carpenter
Quoted 17 lines · Nigel Christian

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

Addresses-Coverity: ("Unused value")

---
 drivers/media/usb/uvc/uvc_driver.c | 1 -
 1 file changed, 1 deletion(-)
drivers/media/usb/uvc/uvc_driver.c +0 -0
index 9a791d8ef200..370b086c6e22 100644
@@ -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]);
 
Quoted 6 lines

drivers/media/usb/uvc/uvc_driver.c static int uvc_parse_format(struct uvc_device *dev, · line 772

Quoted 3 lines
drivers/media/usb/uvc/uvc_driver.c +0 -1
-		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.

Signature · 3 lines
Regards,

Laurent Pinchart