Skip to content

Commit e67b5f8

Browse files
Darshanr5051Hans Verkuil
authored andcommitted
media: uvcvideo: Fix assignment in if condition
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>
1 parent ecba852 commit e67b5f8

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

drivers/media/usb/uvc/uvc_status.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ static int uvc_input_init(struct uvc_device *dev)
6262
__set_bit(EV_KEY, input->evbit);
6363
__set_bit(KEY_CAMERA, input->keybit);
6464

65-
if ((ret = input_register_device(input)) < 0)
65+
ret = input_register_device(input);
66+
if (ret < 0)
6667
goto error;
6768

6869
dev->input = input;

0 commit comments

Comments
 (0)