vidioc_streamoff can be called multiple times from userspace, but we
should only call media_pipeline_stop when we're actually setup.

This became more noticeable after commit 2a2599c66368 ("[media] media:
entity: Catch unbalanced media_pipeline_stop calls") was merged as it
added a WARN for unbalanced calls to media_pipeline_stop.

Signed-off-by: Jonathan Bakker <xc-rac...@live.ca>
---
Changes from v1:
- re-worded commit message for a better description of the problem
---
 drivers/media/platform/exynos4-is/fimc-capture.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/exynos4-is/fimc-capture.c 
b/drivers/media/platform/exynos4-is/fimc-capture.c
index e70785d8a809..887a736b2e0e 100644
--- a/drivers/media/platform/exynos4-is/fimc-capture.c
+++ b/drivers/media/platform/exynos4-is/fimc-capture.c
@@ -1232,8 +1232,11 @@ static int fimc_cap_streamoff(struct file *file, void 
*priv,
        if (ret < 0)
                return ret;
 
-       media_pipeline_stop(&vc->ve.vdev.entity);
-       vc->streaming = false;
+       if (vc->streaming) {
+               media_pipeline_stop(&vc->ve.vdev.entity);
+               vc->streaming = false;
+       }
+
        return 0;
 }
 
-- 
2.20.1

Reply via email to