[PATCH 2/2] media: uvcvideo: Do not re-reference dev->udev

Ricardo Ribalda posted 2 patches 2 months, 1 week ago
[PATCH 2/2] media: uvcvideo: Do not re-reference dev->udev
Posted by Ricardo Ribalda 2 months, 1 week ago
dev->udev is already referenced by the variable udev. Let's use it.

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
 drivers/media/usb/uvc/uvc_driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
index d09d1286da0f61d5953125df23ed92555585e8f2..209cedeff59e8be2e96ce79c3d395a5a85a336c6 100644
--- a/drivers/media/usb/uvc/uvc_driver.c
+++ b/drivers/media/usb/uvc/uvc_driver.c
@@ -882,7 +882,7 @@ static int uvc_parse_vendor_control(struct uvc_device *dev,
 	unsigned int n, p;
 	int handled = 0;
 
-	switch (le16_to_cpu(dev->udev->descriptor.idVendor)) {
+	switch (le16_to_cpu(udev->descriptor.idVendor)) {
 	case 0x046d:		/* Logitech */
 		if (buffer[1] != 0x41 || buffer[2] != 0x01)
 			break;

-- 
2.50.1.470.g6ba607880d-goog
Re: [PATCH 2/2] media: uvcvideo: Do not re-reference dev->udev
Posted by Laurent Pinchart 2 months, 1 week ago
On Fri, Jul 25, 2025 at 11:01:30AM +0000, Ricardo Ribalda wrote:
> dev->udev is already referenced by the variable udev. Let's use it.

The variable is used in a single location. I would probably have dropped
it instead, but I don't have a strong preference. If you prefer it this
way,

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

Please let me know if you will send a patch to drop the variable
instead, or if I should merge this one.

> Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
> ---
>  drivers/media/usb/uvc/uvc_driver.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
> index d09d1286da0f61d5953125df23ed92555585e8f2..209cedeff59e8be2e96ce79c3d395a5a85a336c6 100644
> --- a/drivers/media/usb/uvc/uvc_driver.c
> +++ b/drivers/media/usb/uvc/uvc_driver.c
> @@ -882,7 +882,7 @@ static int uvc_parse_vendor_control(struct uvc_device *dev,
>  	unsigned int n, p;
>  	int handled = 0;
>  
> -	switch (le16_to_cpu(dev->udev->descriptor.idVendor)) {
> +	switch (le16_to_cpu(udev->descriptor.idVendor)) {
>  	case 0x046d:		/* Logitech */
>  		if (buffer[1] != 0x41 || buffer[2] != 0x01)
>  			break;

-- 
Regards,

Laurent Pinchart
Re: [PATCH 2/2] media: uvcvideo: Do not re-reference dev->udev
Posted by Ricardo Ribalda 2 months, 1 week ago
Hi Laurent

On Fri, 25 Jul 2025 at 13:27, Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:
>
> On Fri, Jul 25, 2025 at 11:01:30AM +0000, Ricardo Ribalda wrote:
> > dev->udev is already referenced by the variable udev. Let's use it.
>
> The variable is used in a single location. I would probably have dropped
> it instead, but I don't have a strong preference. If you prefer it this
> way,
>

I believe that it is used twice.

Anything works for me. Feel free to change it the way you prefer
when/if you merge it, or land it as is.

> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
>
> Please let me know if you will send a patch to drop the variable
> instead, or if I should merge this one.
>
> > Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
> > ---
> >  drivers/media/usb/uvc/uvc_driver.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
> > index d09d1286da0f61d5953125df23ed92555585e8f2..209cedeff59e8be2e96ce79c3d395a5a85a336c6 100644
> > --- a/drivers/media/usb/uvc/uvc_driver.c
> > +++ b/drivers/media/usb/uvc/uvc_driver.c
> > @@ -882,7 +882,7 @@ static int uvc_parse_vendor_control(struct uvc_device *dev,
> >       unsigned int n, p;
> >       int handled = 0;
> >
> > -     switch (le16_to_cpu(dev->udev->descriptor.idVendor)) {
> > +     switch (le16_to_cpu(udev->descriptor.idVendor)) {
> >       case 0x046d:            /* Logitech */
> >               if (buffer[1] != 0x41 || buffer[2] != 0x01)
> >                       break;
>
> --
> Regards,
>
> Laurent Pinchart



-- 
Ricardo Ribalda