All of lore.kernel.org
 help / color / mirror / Atom feed
From: fasih0001@gmail.com
To: unlisted-recipients:; (no To-header on input)
Cc: mchehab@kernel.org, linux-media@vger.kernel.org,
	linux-kernel@vger.kernel.org, Fasih <fasih0001@gmail.com>
Subject: [PATCH] usb: uvc: Fix macro in uvc_driver.c for complex values
Date: Mon,  4 Sep 2023 14:45:11 +0500	[thread overview]
Message-ID: <20230904094511.11880-1-fasih0001@gmail.com> (raw)
In-Reply-To: <20230903205906.GD13794@pendragon.ideasonboard.com>

From: Fasih <fasih0001@gmail.com>

The macro UVC_INFO_QUIRK(q) in uvc_driver.c initializes a structure
using a compound literal, and the complex value within the macro was
not properly enclosed in parentheses. This could lead to operator
precedence issues and reduced code clarity.

This commit adds an extra set of parentheses to the macro definition
to ensure correct evaluation and adherence to best practices. This
change also improves code readability and portability.

Signed-off-by: Syed Muhammad Fasih Ul Hassan <fasih0001@gmail.com>
Signed-off-by: Fasih <fasih0001@gmail.com>
---
 drivers/media/usb/uvc/uvc_driver.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
index 08fcd2ffa727..63999f1c8d55 100644
--- a/drivers/media/usb/uvc/uvc_driver.c
+++ b/drivers/media/usb/uvc/uvc_driver.c
@@ -2417,9 +2417,9 @@ static const struct uvc_device_info uvc_quirk_force_y8 = {
 	.quirks = UVC_QUIRK_FORCE_Y8,
 };
 
-#define UVC_INFO_QUIRK(q) (kernel_ulong_t)&(struct uvc_device_info){.quirks = q}
-#define UVC_INFO_META(m) (kernel_ulong_t)&(struct uvc_device_info) \
-	{.meta_format = m}
+#define UVC_INFO_QUIRK(q) ((kernel_ulong_t)&(struct uvc_device_info){.quirks = q})
+#define UVC_INFO_META(m) ((kernel_ulong_t)&(struct uvc_device_info) \
+	{.meta_format = m})
 
 /*
  * The Logitech cameras listed below have their interface class set to
-- 
2.17.1


      reply	other threads:[~2023-09-04  9:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-03  9:54 [PATCH] uvc_driver: Error Fix in the file drivers/media/usb/uvc/uvc_driver.c fasih0001
2023-09-03 20:59 ` Laurent Pinchart
2023-09-04  9:45   ` fasih0001 [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=20230904094511.11880-1-fasih0001@gmail.com \
    --to=fasih0001@gmail.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.