diff mbox series

[v4,9/9] media: v4l: subdev: Warn on stream when accessing stream-unaware data

Message ID 20231026070329.948847-10-sakari.ailus@linux.intel.com
State New
Headers show
Series Unify sub-device state access functions | expand

Commit Message

Sakari Ailus Oct. 26, 2023, 7:03 a.m. UTC
Warn if the stream is set ot a non-zero value on sub-device pad state
access functions. A driver bug is required for triggering the warning.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
 drivers/media/v4l2-core/v4l2-subdev.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c
index bd0d89c2996f..b7d2de6e750a 100644
--- a/drivers/media/v4l2-core/v4l2-subdev.c
+++ b/drivers/media/v4l2-core/v4l2-subdev.c
@@ -1681,7 +1681,7 @@  __v4l2_subdev_state_get_format_stream(struct v4l2_subdev_state *state,
 		return NULL;
 
 	if (state->pads) {
-		if (stream)
+		if (WARN_ON(stream))
 			return NULL;
 
 		if (WARN_ON(pad >= state->sd->entity.num_pads))
@@ -1715,7 +1715,7 @@  __v4l2_subdev_state_get_crop_stream(struct v4l2_subdev_state *state,
 		return NULL;
 
 	if (state->pads) {
-		if (stream)
+		if (WARN_ON(stream))
 			return NULL;
 
 		if (WARN_ON(pad >= state->sd->entity.num_pads))
@@ -1749,7 +1749,7 @@  __v4l2_subdev_state_get_compose_stream(struct v4l2_subdev_state *state,
 		return NULL;
 
 	if (state->pads) {
-		if (stream)
+		if (WARN_ON(stream))
 			return NULL;
 
 		if (WARN_ON(pad >= state->sd->entity.num_pads))