Commit dca7cc1c authored by Niklas Söderlund's avatar Niklas Söderlund Committed by Mauro Carvalho Chehab

media: rcar-vin: Free buffers with error if hardware stop fails

The driver already has logic to detect if it fails to stop properly and
report this error to the user. The driver however did not report the
unused buffers or buffers given to the hardware (if any) with an error,
the buffers where instead returned to user-space in the active state.

Build on the existing detection of the error condition and correctly
return the buffers with an error if it triggers.
Signed-off-by: default avatarNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 0bbaec38
......@@ -1371,6 +1371,16 @@ void rvin_stop_streaming(struct rvin_dev *vin)
spin_unlock_irqrestore(&vin->qlock, flags);
/* If something went wrong, free buffers with an error. */
if (!buffersFreed) {
return_unused_buffers(vin, VB2_BUF_STATE_ERROR);
for (i = 0; i < HW_BUFFER_NUM; i++) {
if (vin->buf_hw[i].buffer)
vb2_buffer_done(&vin->buf_hw[i].buffer->vb2_buf,
VB2_BUF_STATE_ERROR);
}
}
rvin_set_stream(vin, 0);
/* disable interrupts */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment