Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1322501

[PATCH] media: Media Controller fix to not let stream_count go negative

From Shuah Khan <shuahkh@osg.samsung.com>
Newsgroups linux.kernel
Subject [PATCH] media: Media Controller fix to not let stream_count go negative
Date 2016-01-30 21:20 +0100
Message-ID <qWK9Y-DX-5@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


Change media_entity_pipeline_stop() to not decrement
stream_count of an inactive media pipeline. Doing so,
results in preventing starting the pipeline.

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
---
 drivers/media/media-entity.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c
index e89d85a..f2e4360 100644
--- a/drivers/media/media-entity.c
+++ b/drivers/media/media-entity.c
@@ -452,9 +452,12 @@ error:
 	media_entity_graph_walk_start(graph, entity_err);
 
 	while ((entity_err = media_entity_graph_walk_next(graph))) {
-		entity_err->stream_count--;
-		if (entity_err->stream_count == 0)
-			entity_err->pipe = NULL;
+		/* don't let the stream_count go negative */
+		if (entity->stream_count > 0) {
+			entity_err->stream_count--;
+			if (entity_err->stream_count == 0)
+				entity_err->pipe = NULL;
+		}
 
 		/*
 		 * We haven't increased stream_count further than this
@@ -486,9 +489,12 @@ void media_entity_pipeline_stop(struct media_entity *entity)
 	media_entity_graph_walk_start(graph, entity);
 
 	while ((entity = media_entity_graph_walk_next(graph))) {
-		entity->stream_count--;
-		if (entity->stream_count == 0)
-			entity->pipe = NULL;
+		/* don't let the stream_count go negative */
+		if (entity->stream_count > 0) {
+			entity->stream_count--;
+			if (entity->stream_count == 0)
+				entity->pipe = NULL;
+		}
 	}
 
 	if (!--pipe->streaming_count)
-- 
2.5.0

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] media: Media Controller fix to not let stream_count go negative Shuah Khan <shuahkh@osg.samsung.com> - 2016-01-30 21:20 +0100
  Re: [PATCH] media: Media Controller fix to not let stream_count go  negative Sakari Ailus <sakari.ailus@iki.fi> - 2016-02-03 00:00 +0100
    Re: [PATCH] media: Media Controller fix to not let stream_count go  negative Shuah Khan <shuahkh@osg.samsung.com> - 2016-02-03 00:10 +0100
      Re: [PATCH] media: Media Controller fix to not let stream_count go  negative Sakari Ailus <sakari.ailus@iki.fi> - 2016-02-03 00:10 +0100
        Re: [PATCH] media: Media Controller fix to not let stream_count go  negative Shuah Khan <shuahkh@osg.samsung.com> - 2016-02-03 00:20 +0100

csiph-web