Skip to content

Commit f3da84f

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 f3da84f

File tree

1 file changed

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

1 file changed

+9
-11
lines changed

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

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -968,20 +968,18 @@ static void pispbe_node_stop_streaming(struct vb2_queue *q)
968968
spin_lock_irq(&pispbe->hw_lock);
969969
node_group->streaming_map &= ~BIT(node->id);
970970

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);
971+
/*
972+
* If a node has stopped streaming release all jobs belonging to the
973+
* node group immediately.
974+
*/
975+
list_for_each_entry_safe(job, temp, &pispbe->job_queue, queue) {
976+
if (job->node_group == node->node_group) {
977+
list_del(&job->queue);
978+
kfree(job);
979+
}
977980
}
978981
spin_unlock_irq(&pispbe->hw_lock);
979982

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

0 commit comments

Comments
 (0)