From: Robert Ijtsma via B4 Relay <devnull+robertijtsma.gmail.com@kernel.org>
To: Bryan O'Donoghue <bryan.odonoghue@linaro.org>,
Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>,
Loic Poulain <loic.poulain@oss.qualcomm.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org,
Robert Ijtsma <robertijtsma@gmail.com>
Subject: [PATCH 5/5] media: qcom: camss: video: stop started subdevs on start_streaming failure
Date: Sun, 22 Nov 2026 14:35:53 +0100 [thread overview]
Message-ID: <20261122-camss-fixes-v1-5-9df4deb87ea2@gmail.com> (raw)
In-Reply-To: <20261122-camss-fixes-v1-0-9df4deb87ea2@gmail.com>
From: Robert Ijtsma <robertijtsma@gmail.com>
If a subdevice fails s_stream(1) partway through video_start_streaming(),
previously started subdevices earlier in the pipeline (such as the VFE
and CSID) are never stopped. This leaks VFE stream counts and write
master reservations, leaving the pipeline stuck on subsequent stream
attempts.
Walk the pipeline from the video device up to the failing entity and
call s_stream(0) on each already-started subdevice before stopping the
media pipeline and flushing buffers.
Fixes: 0ac2586c410f ("media: camss: Add files which handle the video device nodes")
Signed-off-by: Robert Ijtsma <robertijtsma@gmail.com>
---
drivers/media/platform/qcom/camss/camss-video.c | 27 ++++++++++++++++++++++---
1 file changed, 24 insertions(+), 3 deletions(-)
diff --git a/drivers/media/platform/qcom/camss/camss-video.c b/drivers/media/platform/qcom/camss/camss-video.c
index 0852eb6..6f7b9f3 100644
--- a/drivers/media/platform/qcom/camss/camss-video.c
+++ b/drivers/media/platform/qcom/camss/camss-video.c
@@ -253,7 +253,7 @@ static int video_start_streaming(struct vb2_queue *q, unsigned int count)
{
struct camss_video *video = vb2_get_drv_priv(q);
struct video_device *vdev = &video->vdev;
- struct media_entity *entity;
+ struct media_entity *entity, *failed_entity;
struct media_pad *pad;
struct v4l2_subdev *subdev;
int ret;
@@ -282,12 +282,33 @@ static int video_start_streaming(struct vb2_queue *q, unsigned int count)
subdev = media_entity_to_v4l2_subdev(entity);
ret = v4l2_subdev_call(subdev, video, s_stream, 1);
- if (ret < 0 && ret != -ENOIOCTLCMD)
- goto error;
+ if (ret < 0 && ret != -ENOIOCTLCMD) {
+ failed_entity = entity;
+ goto error_stop_subdevs;
+ }
}
return 0;
+error_stop_subdevs:
+ entity = &vdev->entity;
+ while (1) {
+ pad = &entity->pads[0];
+ if (!(pad->flags & MEDIA_PAD_FL_SINK))
+ break;
+
+ pad = media_pad_remote_pad_first(pad);
+ if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
+ break;
+
+ entity = pad->entity;
+ if (entity == failed_entity)
+ break;
+
+ subdev = media_entity_to_v4l2_subdev(entity);
+ v4l2_subdev_call(subdev, video, s_stream, 0);
+ }
+
error:
video_device_pipeline_stop(vdev);
--
2.56.0
prev parent reply other threads:[~2026-11-22 13:36 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-22 13:35 [PATCH 0/5] media: qcom: camss: fix VFE/CSID/video error handling and register bugs Robert Ijtsma via B4 Relay
2026-11-22 13:35 ` [PATCH 1/5] media: qcom: camss: vfe-17x: check status1 for RDI SOF interrupts Robert Ijtsma via B4 Relay
2026-11-22 13:35 ` [PATCH 2/5] media: qcom: camss: csid-gen2: fix RDI enable bit manipulation Robert Ijtsma via B4 Relay
2026-11-22 13:35 ` [PATCH 3/5] media: qcom: camss: csid: release parent device on power-on failure Robert Ijtsma via B4 Relay
2026-11-22 13:35 ` [PATCH 4/5] media: qcom: camss: vfe: destroy mutexes after unregistering entities Robert Ijtsma via B4 Relay
2026-11-22 13:35 ` Robert Ijtsma via B4 Relay [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261122-camss-fixes-v1-5-9df4deb87ea2@gmail.com \
--to=devnull+robertijtsma.gmail.com@kernel.org \
--cc=bryan.odonoghue@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=loic.poulain@oss.qualcomm.com \
--cc=mchehab@kernel.org \
--cc=robertijtsma@gmail.com \
--cc=vladimir.zapolskiy@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).