[v2,2/3] media: uvc_driver: fix assignment inside if condition

Message ID 20221025050450.1743072-2-pedro.guilherme@espectro.eng.br
State New
Headers
Series [v2,1/3] media: uvc_driver: fix missing newline after declarations |

Commit Message

Pedro Guilherme Siqueira Moreira Oct. 25, 2022, 5:04 a.m. UTC
  Fixes 'do not use assignment in if condition' errors issued by
scripts/checkpatch.pl on drivers/media/usb/uvc/uvc_driver.c

Signed-off-by: Pedro Guilherme Siqueira Moreira <pedro.guilherme@espectro.eng.br>
---
 drivers/media/usb/uvc/uvc_driver.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
  

Comments

Ricardo Ribalda Oct. 25, 2022, 8:45 a.m. UTC | #1
On Tue, 25 Oct 2022 at 07:08, Pedro Guilherme Siqueira Moreira
<pedro.guilherme@espectro.eng.br> wrote:
>
> Fixes 'do not use assignment in if condition' errors issued by
> scripts/checkpatch.pl on drivers/media/usb/uvc/uvc_driver.c
>
> Signed-off-by: Pedro Guilherme Siqueira Moreira <pedro.guilherme@espectro.eng.br>
Reviewed-by: Ricardo Ribalda <ribalda@chromium.org>
> ---
>  drivers/media/usb/uvc/uvc_driver.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
> index b591ad823c66..7b6c97ad3a41 100644
> --- a/drivers/media/usb/uvc/uvc_driver.c
> +++ b/drivers/media/usb/uvc/uvc_driver.c
> @@ -1174,7 +1174,8 @@ static int uvc_parse_control(struct uvc_device *dev)
>                     buffer[1] != USB_DT_CS_INTERFACE)
>                         goto next_descriptor;
>
> -               if ((ret = uvc_parse_standard_control(dev, buffer, buflen)) < 0)
> +               ret = uvc_parse_standard_control(dev, buffer, buflen);
> +               if (ret < 0)
>                         return ret;
>
>  next_descriptor:
> @@ -2213,7 +2214,8 @@ static int uvc_probe(struct usb_interface *intf,
>         usb_set_intfdata(intf, dev);
>
>         /* Initialize the interrupt URB. */
> -       if ((ret = uvc_status_init(dev)) < 0) {
> +       ret = uvc_status_init(dev);
> +       if (ret < 0) {
>                 dev_info(&dev->udev->dev,
>                          "Unable to initialize the status endpoint (%d), status interrupt will not be supported.\n",
>                          ret);
> --
> 2.38.1
>
  
Laurent Pinchart Oct. 25, 2022, 6:54 p.m. UTC | #2
On Tue, Oct 25, 2022 at 10:45:40AM +0200, Ricardo Ribalda wrote:
> On Tue, 25 Oct 2022 at 07:08, Pedro Guilherme Siqueira Moreira
> <pedro.guilherme@espectro.eng.br> wrote:
> >
> > Fixes 'do not use assignment in if condition' errors issued by
> > scripts/checkpatch.pl on drivers/media/usb/uvc/uvc_driver.c
> >
> > Signed-off-by: Pedro Guilherme Siqueira Moreira <pedro.guilherme@espectro.eng.br>
>
> Reviewed-by: Ricardo Ribalda <ribalda@chromium.org>

Likewise, this looks good to me.

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

> > ---
> >  drivers/media/usb/uvc/uvc_driver.c | 6 ++++--
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
> > index b591ad823c66..7b6c97ad3a41 100644
> > --- a/drivers/media/usb/uvc/uvc_driver.c
> > +++ b/drivers/media/usb/uvc/uvc_driver.c
> > @@ -1174,7 +1174,8 @@ static int uvc_parse_control(struct uvc_device *dev)
> >                     buffer[1] != USB_DT_CS_INTERFACE)
> >                         goto next_descriptor;
> >
> > -               if ((ret = uvc_parse_standard_control(dev, buffer, buflen)) < 0)
> > +               ret = uvc_parse_standard_control(dev, buffer, buflen);
> > +               if (ret < 0)
> >                         return ret;
> >
> >  next_descriptor:
> > @@ -2213,7 +2214,8 @@ static int uvc_probe(struct usb_interface *intf,
> >         usb_set_intfdata(intf, dev);
> >
> >         /* Initialize the interrupt URB. */
> > -       if ((ret = uvc_status_init(dev)) < 0) {
> > +       ret = uvc_status_init(dev);
> > +       if (ret < 0) {
> >                 dev_info(&dev->udev->dev,
> >                          "Unable to initialize the status endpoint (%d), status interrupt will not be supported.\n",
> >                          ret);
  

Patch

diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
index b591ad823c66..7b6c97ad3a41 100644
--- a/drivers/media/usb/uvc/uvc_driver.c
+++ b/drivers/media/usb/uvc/uvc_driver.c
@@ -1174,7 +1174,8 @@  static int uvc_parse_control(struct uvc_device *dev)
 		    buffer[1] != USB_DT_CS_INTERFACE)
 			goto next_descriptor;
 
-		if ((ret = uvc_parse_standard_control(dev, buffer, buflen)) < 0)
+		ret = uvc_parse_standard_control(dev, buffer, buflen);
+		if (ret < 0)
 			return ret;
 
 next_descriptor:
@@ -2213,7 +2214,8 @@  static int uvc_probe(struct usb_interface *intf,
 	usb_set_intfdata(intf, dev);
 
 	/* Initialize the interrupt URB. */
-	if ((ret = uvc_status_init(dev)) < 0) {
+	ret = uvc_status_init(dev);
+	if (ret < 0) {
 		dev_info(&dev->udev->dev,
 			 "Unable to initialize the status endpoint (%d), status interrupt will not be supported.\n",
 			 ret);