[PATCH] media: mx2-emmaprp: return failed buffers on bus errors
From: Avi Weiss
Date: Thu Oct 29 2026 - 10:56:09 EST
emmaprp_irq() resets the PrP engine on a read or channel-2 write
bus error but leaves the source and destination buffers queued.
v4l2_m2m_job_finish() releases the job without returning either
buffer, allowing the same pair to be scheduled again.
Complete both buffers with VB2_BUF_STATE_ERROR before finishing
the job so userspace can dequeue the failed pair.
Fixes: 8091cb7d9ce6 ("[media] MEM2MEM: Add support for eMMa-PrP mem2mem operations")
Signed-off-by: Avi Weiss <thnkslprpt@xxxxxxxxx>
---
drivers/media/platform/nxp/mx2_emmaprp.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/media/platform/nxp/mx2_emmaprp.c b/drivers/media/platform/nxp/mx2_emmaprp.c
index d51a621007788..f957383e8df55 100644
--- a/drivers/media/platform/nxp/mx2_emmaprp.c
+++ b/drivers/media/platform/nxp/mx2_emmaprp.c
@@ -354,6 +354,10 @@ static irqreturn_t emmaprp_irq(int irq_emma, void *data)
(irqst & PRP_INTR_ST_CH2WERR)) {
pr_err("PrP bus error occurred, this transfer is probably corrupted\n");
writel(PRP_CNTL_SWRST, pcdev->base_emma + PRP_CNTL);
+ v4l2_m2m_buf_done_and_job_finish(pcdev->m2m_dev,
+ curr_ctx->fh.m2m_ctx,
+ VB2_BUF_STATE_ERROR);
+ return IRQ_HANDLED;
} else if (irqst & PRP_INTR_ST_CH2B1CI) { /* buffer ready */
src_vb = v4l2_m2m_src_buf_remove(curr_ctx->fh.m2m_ctx);
dst_vb = v4l2_m2m_dst_buf_remove(curr_ctx->fh.m2m_ctx);
base-commit: c339f4010dea8b0d754f84ace70cd1b089878ef8
--
2.43.0