Skip to contentSkip to conversation

media: uvcvideo: avoid variable shadowing in uvc_ctrl_cleanup_fh

PATCH In review Desnes Nunes 3 participants 4 messages Jul 8, 2025 – Jul 21, 2025 1 message not in the archive

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

PATCH v3 1/1 media: uvcvideo: avoid variable shadowing in uvc_ctrl_cleanup_fh

This avoids a variable loop shadowing occurring between the local loop iterating through the uvc_entity's controls and the global one going through the pending async controls of the file handle

Fixes 10acb9101355 ("media: uvcvideo: Increase/decrease the PM counter per IOCTL")
---
 drivers/media/usb/uvc/uvc_ctrl.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/media/usb/uvc/uvc_ctrl.c +1 -2
index 303b7509ec47..6b9486749c3f 100644
@@ -3299,7 +3299,6 @@ int uvc_ctrl_init_device(struct uvc_device *dev)
 void uvc_ctrl_cleanup_fh(struct uvc_fh *handle)
 {
 	struct uvc_entity *entity;
-	int i;
 
 	guard(mutex)(&handle->chain->ctrl_mutex);
 
@@ -3317,7 +3316,7 @@ void uvc_ctrl_cleanup_fh(struct uvc_fh *handle)
 	if (!WARN_ON(handle->pending_async_ctrls))
 		return;
 
-	for (i = 0; i < handle->pending_async_ctrls; i++)
+	for (unsigned int i = 0; i < handle->pending_async_ctrls; i++)
 		uvc_pm_put(handle->stream->dev);
 }
 
Signature · 1 line
2.50.0
maintainer Reviewed-by on v3 1/1
#1 lore raw

Hi Desnes,

Thank you for the patch.

Quoted 3 lines · Desnes Nunes

This avoids a variable loop shadowing occurring between the local loop iterating through the uvc_entity's controls and the global one going through the pending async controls of the file handle

s/handle/handle./

(easily handled when applying the patch, no need to resend)

Quoted 2 lines
Fixes 10acb9101355 ("media: uvcvideo: Increase/decrease the PM counter per IOCTL")

I think CI will ask for Cc to go after Fixes. If so that can also be handled when applying.

Quoted 1 line
Quoted 25 lines
---
 drivers/media/usb/uvc/uvc_ctrl.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/media/usb/uvc/uvc_ctrl.c +1 -2
index 303b7509ec47..6b9486749c3f 100644
@@ -3299,7 +3299,6 @@ int uvc_ctrl_init_device(struct uvc_device *dev)
 void uvc_ctrl_cleanup_fh(struct uvc_fh *handle)
 {
 	struct uvc_entity *entity;
-	int i;
 
 	guard(mutex)(&handle->chain->ctrl_mutex);
 
@@ -3317,7 +3316,7 @@ void uvc_ctrl_cleanup_fh(struct uvc_fh *handle)
 	if (!WARN_ON(handle->pending_async_ctrls))
 		return;
 
-	for (i = 0; i < handle->pending_async_ctrls; i++)
+	for (unsigned int i = 0; i < handle->pending_async_ctrls; i++)
 		uvc_pm_put(handle->stream->dev);
 }
 
Signature · 3 lines
Regards,

Laurent Pinchart
maintainer
#2 lore raw

Hi,

Quoted 16 lines · Laurent Pinchart

Hi Desnes,

Thank you for the patch.

Quoted 3 lines · Desnes Nunes

This avoids a variable loop shadowing occurring between the local loop iterating through the uvc_entity's controls and the global one going through the pending async controls of the file handle

s/handle/handle./

(easily handled when applying the patch, no need to resend)

Quoted 2 lines
Fixes 10acb9101355 ("media: uvcvideo: Increase/decrease the PM counter per IOCTL")
Quoted 6 lines

I think CI will ask for Cc to go after Fixes. If so that can also be handled when applying.

Quoted 1 line

Thank you both for the patch and review. I've amended the commit message while applying as suggested by Laurent and I have merged this into:

https://gitlab.freedesktop.org/linux-media/users/uvc/-/commits/for-next/

Regards,

Hans

Quoted 26 lines
Quoted 25 lines
---
 drivers/media/usb/uvc/uvc_ctrl.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/media/usb/uvc/uvc_ctrl.c +1 -2
index 303b7509ec47..6b9486749c3f 100644
@@ -3299,7 +3299,6 @@ int uvc_ctrl_init_device(struct uvc_device *dev)
 void uvc_ctrl_cleanup_fh(struct uvc_fh *handle)
 {
 	struct uvc_entity *entity;
-	int i;
 
 	guard(mutex)(&handle->chain->ctrl_mutex);
 
@@ -3317,7 +3316,7 @@ void uvc_ctrl_cleanup_fh(struct uvc_fh *handle)
 	if (!WARN_ON(handle->pending_async_ctrls))
 		return;
 
-	for (i = 0; i < handle->pending_async_ctrls; i++)
+	for (unsigned int i = 0; i < handle->pending_async_ctrls; i++)
 		uvc_pm_put(handle->stream->dev);
 }
 

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw

Hello,

Quoted 11 lines · Patchwork Integration

Dear Desnes Nunes:

Thanks for your patches! Unfortunately the Media CI robot detected some issues:

Please fix your series, and upload a new version. If you have a patchwork account, do not forget to mark the current series as Superseded.

For more details, check the full report at:
https://linux-media.pages.freedesktop.org/-/users/patchwork/-/jobs/80019682/artifacts/report.htm .

It seems that there was a connection error with the container?

Quoted 11 lines

Best regards, and Happy Hacking!
Media CI robot on behalf of the linux-media community.

---
Check the latest rules for contributing your patches at:
https://docs.kernel.org/driver-api/media/maintainer-entry-profile.html

If you believe that the CI is wrong, kindly open an issue at
https://gitlab.freedesktop.org/linux-media/media-ci/-/issues or reply-all to this message.

Just re-trigger the pipeline if the connection is back?

Best Regards,

Signature · 1 line
Desnes Nunes