]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
media: uvcvideo: Fix assignment in if condition
authorDarshan Rathod <darshanrathod475@gmail.com>
Tue, 15 Jul 2025 11:30:56 +0000 (11:30 +0000)
committerHans Verkuil <hverkuil+cisco@kernel.org>
Sat, 13 Sep 2025 16:34:57 +0000 (18:34 +0200)
The function uvc_input_init() uses an assignment of the return value
of input_register_device() within the condition of an if statement.

This coding style is discouraged by the Linux kernel coding style guide
as it can be confused with a comparison and hide potential bugs.
The checkpatch.pl script flags this as an error:
"ERROR: do not use assignment in if condition"

Separate the assignment into its own statement before the conditional
check to improve code readability and adhere to the kernel's
coding standards.

Signed-off-by: Darshan Rathod <darshanrathod475@gmail.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans de Goede <hansg@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
drivers/media/usb/uvc/uvc_status.c

index ee01dce4b7834b05aab95379191c305cf8cec7f7..3c29c0bb3f7cabadfbb9cd8e6780cd3a82a0dfcf 100644 (file)
@@ -62,7 +62,8 @@ static int uvc_input_init(struct uvc_device *dev)
        __set_bit(EV_KEY, input->evbit);
        __set_bit(KEY_CAMERA, input->keybit);
 
-       if ((ret = input_register_device(input)) < 0)
+       ret = input_register_device(input);
+       if (ret < 0)
                goto error;
 
        dev->input = input;