]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
media: venus: vdec: fix error state assignment for zero bytesused
authorRenjiang Han <renjiang.han@oss.qualcomm.com>
Thu, 11 Dec 2025 09:50:39 +0000 (15:20 +0530)
committerHans Verkuil <hverkuil+cisco@kernel.org>
Tue, 20 Jan 2026 12:19:32 +0000 (13:19 +0100)
When hfi_session_flush is issued, all queued buffers are returned to
the V4L2 driver. Some of these buffers are not processed and have
bytesused = 0. Currently, the driver marks such buffers as error even
during drain operations, which can incorrectly flag EOS buffers.

Only capture buffers with zero payload (and not EOS) should be marked
with VB2_BUF_STATE_ERROR. The check is performed inside the non-EOS
branch to ensure correct handling.

Fixes: 51df3c81ba10b ("media: venus: vdec: Mark flushed buffers with error state")
Signed-off-by: Renjiang Han <renjiang.han@oss.qualcomm.com>
Reviewed-by: Vikash Garodia <vikash.garodia@oss.qualcomm.com>
Cc: stable@vger.kernel.org
Signed-off-by: Bryan O'Donoghue <bod@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
drivers/media/platform/qcom/venus/vdec.c

index 4a6641fdffcf79705893be58c7ec5cf485e2fab9..d0bd2d86a31f9a18cb68b08ba66affdf8fc5092d 100644 (file)
@@ -1440,10 +1440,10 @@ static void vdec_buf_done(struct venus_inst *inst, unsigned int buf_type,
                                inst->drain_active = false;
                                inst->codec_state = VENUS_DEC_STATE_STOPPED;
                        }
+               } else {
+                       if (!bytesused)
+                               state = VB2_BUF_STATE_ERROR;
                }
-
-               if (!bytesused)
-                       state = VB2_BUF_STATE_ERROR;
        } else {
                vbuf->sequence = inst->sequence_out++;
        }