usb: uvc: Fix macro in uvc_driver.c for complex values

Message ID (mailing list archive)
State New
Delegated to: Laurent Pinchart
Series usb: uvc: Fix macro in uvc_driver.c for complex values |

Commit Message Sept. 4, 2023, 9:45 a.m. UTC
  From: Fasih <>

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 <>
Signed-off-by: Fasih <>
 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