From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Darshan Rathod <darshanrathod475@gmail.com>
Cc: Hans de Goede <hansg@kernel.org>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] media: uvcvideo: Fix assignment in if condition
Date: Tue, 15 Jul 2025 21:42:57 +0300 [thread overview]
Message-ID: <20250715184257.GM20231@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20250715113056.2519-1-darshanrathod475@gmail.com>
Hi Darshan,
Thank you for the patch.
On Tue, Jul 15, 2025 at 11:30:56AM +0000, Darshan Rathod wrote:
> The function uvc_input_init() used an assignment of the return value
s/used/uses/
> 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>
I'll update the commit message as mentioned above when applying, no need
for a v2.
> ---
> drivers/media/usb/uvc/uvc_status.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/media/usb/uvc/uvc_status.c b/drivers/media/usb/uvc/uvc_status.c
> index ee01dce4b783..3c29c0bb3f7c 100644
> --- a/drivers/media/usb/uvc/uvc_status.c
> +++ b/drivers/media/usb/uvc/uvc_status.c
> @@ -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;
--
Regards,
Laurent Pinchart
prev parent reply other threads:[~2025-07-15 18:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-15 11:30 Darshan Rathod
2025-07-15 18:42 ` Laurent Pinchart [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250715184257.GM20231@pendragon.ideasonboard.com \
--to=laurent.pinchart@ideasonboard.com \
--cc=darshanrathod475@gmail.com \
--cc=hansg@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®