diff mbox

[01/19] media: Enforce single entity->pipe in a pipeline

Message ID 1445900510-1398-2-git-send-email-sakari.ailus@iki.fi (mailing list archive)
State New, archived
Headers show

Commit Message

Sakari Ailus Oct. 26, 2015, 11:01 p.m. UTC
If a different entity->pipe in a pipeline was encountered, a warning was
issued but the execution continued as if nothing had happened. Return an
error instead right there.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
 drivers/media/media-entity.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Mauro Carvalho Chehab Oct. 28, 2015, 12:18 a.m. UTC | #1
Em Tue, 27 Oct 2015 01:01:32 +0200
Sakari Ailus <sakari.ailus@iki.fi> escreveu:

> If a different entity->pipe in a pipeline was encountered, a warning was
> issued but the execution continued as if nothing had happened. Return an
> error instead right there.
> 
> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>

Reviewed-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>

> ---
>  drivers/media/media-entity.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c
> index 66b8db0..d11f440 100644
> --- a/drivers/media/media-entity.c
> +++ b/drivers/media/media-entity.c
> @@ -431,7 +431,12 @@ __must_check int media_entity_pipeline_start(struct media_entity *entity,
>  		DECLARE_BITMAP(has_no_links, MEDIA_ENTITY_MAX_PADS);
>  
>  		entity->stream_count++;
> -		WARN_ON(entity->pipe && entity->pipe != pipe);
> +
> +		if (WARN_ON(entity->pipe && entity->pipe != pipe)) {
> +			ret = -EBUSY;
> +			goto error;
> +		}
> +
>  		entity->pipe = pipe;
>  
>  		/* Already streaming --- no need to check. */
diff mbox

Patch

diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c
index 66b8db0..d11f440 100644
--- a/drivers/media/media-entity.c
+++ b/drivers/media/media-entity.c
@@ -431,7 +431,12 @@  __must_check int media_entity_pipeline_start(struct media_entity *entity,
 		DECLARE_BITMAP(has_no_links, MEDIA_ENTITY_MAX_PADS);
 
 		entity->stream_count++;
-		WARN_ON(entity->pipe && entity->pipe != pipe);
+
+		if (WARN_ON(entity->pipe && entity->pipe != pipe)) {
+			ret = -EBUSY;
+			goto error;
+		}
+
 		entity->pipe = pipe;
 
 		/* Already streaming --- no need to check. */