Skip to content

Commit 1506a5e

Browse files
committed
drivers: media: pisp_be: Fix for job queue removal in stop_streaming()
The existing code unconditionally removes jobs from the job_queue list when all the nodes in a node group have stopped streaming. This will also remove jobs for any other node groups as the job_queue is a common list. Fix this by only conditionally deleting jobs that belong to the current node group. Additionally, delete jobs as soon as the first node in the node group stops streaming. Running a job with an incomplete set of active nodes is invalid. Fixes: 880153e ("media: pisp_be: Split jobs creation and scheduling") Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
1 parent dc3cfb9 commit 1506a5e

File tree

1 file changed

+9
-12
lines changed
  • drivers/media/platform/raspberrypi/pisp_be

1 file changed

+9
-12
lines changed

drivers/media/platform/raspberrypi/pisp_be/pisp_be.c

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -941,7 +941,6 @@ static void pispbe_node_stop_streaming(struct vb2_queue *q)
941941
struct pispbe_dev *pispbe = node_group->pispbe;
942942
struct pispbe_job_descriptor *job, *temp;
943943
struct pispbe_buffer *buf;
944-
LIST_HEAD(tmp_list);
945944

946945
/*
947946
* Now this is a bit awkward. In a simple M2M device we could just wait
@@ -968,20 +967,18 @@ static void pispbe_node_stop_streaming(struct vb2_queue *q)
968967
spin_lock_irq(&pispbe->hw_lock);
969968
node_group->streaming_map &= ~BIT(node->id);
970969

971-
if (node_group->streaming_map == 0) {
972-
/*
973-
* If all nodes have stopped streaming release all jobs
974-
* without holding the lock.
975-
*/
976-
list_splice_init(&pispbe->job_queue, &tmp_list);
970+
/*
971+
* If a node has stopped streaming release all jobs belonging to the
972+
* node group immediately.
973+
*/
974+
list_for_each_entry_safe(job, temp, &pispbe->job_queue, queue) {
975+
if (job->node_group == node->node_group) {
976+
list_del(&job->queue);
977+
kfree(job);
978+
}
977979
}
978980
spin_unlock_irq(&pispbe->hw_lock);
979981

980-
list_for_each_entry_safe(job, temp, &tmp_list, queue) {
981-
list_del(&job->queue);
982-
kfree(job);
983-
}
984-
985982
pm_runtime_mark_last_busy(pispbe->dev);
986983
pm_runtime_put_autosuspend(pispbe->dev);
987984

0 commit comments

Comments
 (0)