[media] media: Enforce single entity->pipe in a pipeline
authorSakari Ailus <sakari.ailus@iki.fi>
Sun, 29 Nov 2015 19:20:02 +0000 (17:20 -0200)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Mon, 11 Jan 2016 14:19:12 +0000 (12:19 -0200)
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>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/media-entity.c

index 6926e0685d0aa2cf5d25b7aea69c21fb495afe88..4822763dcefac294e8ea76196f44b78a10dddfdd 100644 (file)
@@ -323,7 +323,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. */