Commit 12030f48 authored by Sakari Ailus's avatar Sakari Ailus Committed by Mauro Carvalho Chehab

[media] media: entity: Be vocal about failing sanity checks

Commit 3801bc7d ("[media] media: Media Controller fix to not let
stream_count go negative") added a sanity check for negative stream_count,
but a failure of the check remained silent. Make sure the failure is
noticed.
Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 41387a59
...@@ -469,8 +469,8 @@ __must_check int __media_entity_pipeline_start(struct media_entity *entity, ...@@ -469,8 +469,8 @@ __must_check int __media_entity_pipeline_start(struct media_entity *entity,
media_entity_graph_walk_start(graph, entity_err); media_entity_graph_walk_start(graph, entity_err);
while ((entity_err = media_entity_graph_walk_next(graph))) { while ((entity_err = media_entity_graph_walk_next(graph))) {
/* don't let the stream_count go negative */ /* Sanity check for negative stream_count */
if (entity_err->stream_count > 0) { if (!WARN_ON_ONCE(entity_err->stream_count <= 0)) {
entity_err->stream_count--; entity_err->stream_count--;
if (entity_err->stream_count == 0) if (entity_err->stream_count == 0)
entity_err->pipe = NULL; entity_err->pipe = NULL;
...@@ -515,8 +515,8 @@ void __media_entity_pipeline_stop(struct media_entity *entity) ...@@ -515,8 +515,8 @@ void __media_entity_pipeline_stop(struct media_entity *entity)
media_entity_graph_walk_start(graph, entity); media_entity_graph_walk_start(graph, entity);
while ((entity = media_entity_graph_walk_next(graph))) { while ((entity = media_entity_graph_walk_next(graph))) {
/* don't let the stream_count go negative */ /* Sanity check for negative stream_count */
if (entity->stream_count > 0) { if (!WARN_ON_ONCE(entity->stream_count <= 0)) {
entity->stream_count--; entity->stream_count--;
if (entity->stream_count == 0) if (entity->stream_count == 0)
entity->pipe = NULL; entity->pipe = NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment