[PATCH 2/4] [media] cpia2: Adjust two function calls together with a variable assignment

From: SF Markus Elfring
Date: Sun Sep 17 2017 - 09:33:12 EST


From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 17 Sep 2017 12:56:50 +0200

The script "checkpatch.pl" pointed information out like the following.

ERROR: do not use assignment in if condition

Thus fix the affected source code places.

Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
---
drivers/media/usb/cpia2/cpia2_usb.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/media/usb/cpia2/cpia2_usb.c b/drivers/media/usb/cpia2/cpia2_usb.c
index c6be2786a66f..161c9b827f8e 100644
--- a/drivers/media/usb/cpia2/cpia2_usb.c
+++ b/drivers/media/usb/cpia2/cpia2_usb.c
@@ -367,7 +367,8 @@ static void cpia2_usb_complete(struct urb *urb)
if(cam->streaming) {
/* resubmit */
urb->dev = cam->dev;
- if ((i = usb_submit_urb(urb, GFP_ATOMIC)) != 0)
+ i = usb_submit_urb(urb, GFP_ATOMIC);
+ if (i != 0)
ERR("%s: usb_submit_urb ret %d!\n", __func__, i);
}
}
@@ -852,5 +853,5 @@ static int cpia2_usb_probe(struct usb_interface *intf,
}

-
- if((ret = cpia2_init_camera(cam)) < 0) {
+ ret = cpia2_init_camera(cam);
+ if (ret < 0) {
ERR("%s: failed to initialize cpia2 camera (ret = %d)\n", __func__, ret);
--
2.14.1