14736dc2dc822e25de0f90d3e574bda55be9206e
[openwrt/staging/mans0n.git] /
1 From 84fa15b87a5f938c064ee2d9fca43248865ffbec Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Thu, 13 Aug 2020 16:58:18 +0100
4 Subject: [PATCH] staging: vc04_services: codec: Fix incorrect buffer
5 cleanup
6
7 The allocated input and output buffers are initialised in
8 buf_init and should only be cleared up in buf_cleanup.
9 stop_streaming was (incorrectly) cleaning up the buffers to
10 avoid an issue in videobuf2 that had been fixed by the orphaned
11 buffer support.
12
13 Remove the erroneous cleanup.
14
15 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
16 ---
17 .../bcm2835-codec/bcm2835-v4l2-codec.c | 17 +----------------
18 1 file changed, 1 insertion(+), 16 deletions(-)
19
20 --- a/drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c
21 +++ b/drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c
22 @@ -2320,10 +2320,7 @@ static void bcm2835_codec_stop_streaming
23 struct bcm2835_codec_q_data *q_data = get_q_data(ctx, q->type);
24 struct vchiq_mmal_port *port = get_port_data(ctx, q->type);
25 struct vb2_v4l2_buffer *vbuf;
26 - struct vb2_v4l2_buffer *vb2;
27 - struct v4l2_m2m_buffer *m2m;
28 - struct m2m_mmal_buffer *buf;
29 - int ret, i;
30 + int ret;
31
32 v4l2_dbg(1, debug, &ctx->dev->v4l2_dev, "%s: type: %d - return buffers\n",
33 __func__, q->type);
34 @@ -2363,18 +2360,6 @@ static void bcm2835_codec_stop_streaming
35 }
36 }
37
38 - /*
39 - * Release the VCSM handle here as otherwise REQBUFS(0) aborts because
40 - * someone is using the dmabuf before giving the driver a chance to do
41 - * anything about it.
42 - */
43 - for (i = 0; i < q->num_buffers; i++) {
44 - vb2 = to_vb2_v4l2_buffer(q->bufs[i]);
45 - m2m = container_of(vb2, struct v4l2_m2m_buffer, vb);
46 - buf = container_of(m2m, struct m2m_mmal_buffer, m2m);
47 -
48 - bcm2835_codec_mmal_buf_cleanup(&buf->mmal);
49 - }
50
51 /* If both ports disabled, then disable the component */
52 if (!ctx->component->input[0].enabled &&