diff mbox series

[v2,10/11] media: exynos4-is: Handle duplicate calls to vidioc_streamoff

Message ID BN6PR04MB06606A36716392E7634CF8DCA3710@BN6PR04MB0660.namprd04.prod.outlook.com (mailing list archive)
State New, archived
Headers show
Series [v2,01/11] media: exynos4-is: Remove static driver data for S5PV210 FIMC variants | expand

Commit Message

Jonathan Bakker July 30, 2020, 11:01 p.m. UTC
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-racer2@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(-)

Comments

On 31.07.2020 01:01, Jonathan Bakker wrote:
> 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-racer2@live.ca>

Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
diff mbox series

Patch

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;
 }