2020-07-30 23:05:01

by Jonathan Bakker

[permalink] [raw]
Subject: [PATCH v2 10/11] media: exynos4-is: Handle duplicate calls to vidioc_streamoff

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 <[email protected]>
---
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


2020-07-31 09:55:21

by Sylwester Nawrocki

[permalink] [raw]
Subject: Re: [PATCH v2 10/11] media: exynos4-is: Handle duplicate calls to vidioc_streamoff

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 <[email protected]>

Reviewed-by: Sylwester Nawrocki <[email protected]>