Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>

authored by

Niklas Söderlund and committed by
Mauro Carvalho Chehab
dca7cc1c 0bbaec38

+10
+10
drivers/media/platform/rcar-vin/rcar-dma.c
··· 1371 1371 1372 1372 spin_unlock_irqrestore(&vin->qlock, flags); 1373 1373 1374 + /* If something went wrong, free buffers with an error. */ 1375 + if (!buffersFreed) { 1376 + return_unused_buffers(vin, VB2_BUF_STATE_ERROR); 1377 + for (i = 0; i < HW_BUFFER_NUM; i++) { 1378 + if (vin->buf_hw[i].buffer) 1379 + vb2_buffer_done(&vin->buf_hw[i].buffer->vb2_buf, 1380 + VB2_BUF_STATE_ERROR); 1381 + } 1382 + } 1383 + 1374 1384 rvin_set_stream(vin, 0); 1375 1385 1376 1386 /* disable interrupts */