Skip to contentSkip to conversation

media: ipu3-cio2: Fix container_of() macro wrapper arguments

PATCH In review Sakari Ailus 2 participants 2 messages Apr 17, 2023

Subsystems (2)
lore
Share & tools
lore

Sakari Ailus

author maintainer
#0 lore raw

PATCH 1/1 media: ipu3-cio2: Fix container_of() macro wrapper arguments

The argument of the to_sensor_asd() is called the same as the field name for the container_of() macro, so it only works if the argument name is "asd". Fix it.

Also switch to container_of_const().

---
 drivers/media/pci/intel/ipu3/ipu3-cio2-main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/media/pci/intel/ipu3/ipu3-cio2-main.c +2 -1
index fa53d0835c89c..39ad1309a61b5 100644
@@ -1374,7 +1374,8 @@ struct sensor_async_subdev {
 	struct csi2_bus_info csi2;
 };
 
-#define to_sensor_asd(asd)	container_of(asd, struct sensor_async_subdev, asd)
+#define to_sensor_asd(__asd)	\
+	container_of_const(__asd, struct sensor_async_subdev, asd)
 
 /* The .bound() notifier callback when a match is found */
 static int cio2_notifier_bound(struct v4l2_async_notifier *notifier,
Signature · 1 line
2.30.2
Reviewed-by on v1 1/1
#1 lore raw

------------------------------------------------------------------------
BRs,
Bingbu Cao

Quoted 37 lines

-----Original Message-----
From: Sakari Ailus <[email protected]>
Sent: Monday, April 17, 2023 17:30
To: [email protected]
Cc: Cao, Bingbu <[email protected]>
Subject: [PATCH 1/1] media: ipu3-cio2: Fix container_of() macro wrapper arguments

The argument of the to_sensor_asd() is called the same as the field name for the container_of() macro, so it only works if the argument name is "asd". Fix it.

Also switch to container_of_const().

---
drivers/media/pci/intel/ipu3/ipu3-cio2-main.c | 3 ++-

1 file changed, 2 insertions(+), 1 deletion(-)
drivers/media/pci/intel/ipu3/ipu3-cio2-main.c +2 -1
index fa53d0835c89c..39ad1309a61b5 100644
@@ -1374,7 +1374,8 @@ struct sensor_async_subdev {
 	struct csi2_bus_info csi2;
 };
 
-#define to_sensor_asd(asd)	container_of(asd, struct sensor_async_subdev,
 asd)
+#define to_sensor_asd(__asd)	\
+	container_of_const(__asd, struct sensor_async_subdev, asd)
 
 /* The .bound() notifier callback when a match is found */  static int

cio2_notifier_bound(struct v4l2_async_notifier *notifier, --
2.30.2