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
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
13 Remove the erroneous cleanup.
15 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
17 .../bcm2835-codec/bcm2835-v4l2-codec.c | 17 +----------------
18 1 file changed, 1 insertion(+), 16 deletions(-)
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;
32 v4l2_dbg(1, debug, &ctx->dev->v4l2_dev, "%s: type: %d - return buffers\n",
34 @@ -2363,18 +2360,6 @@ static void bcm2835_codec_stop_streaming
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.
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);
48 - bcm2835_codec_mmal_buf_cleanup(&buf->mmal);
51 /* If both ports disabled, then disable the component */
52 if (!ctx->component->input[0].enabled &&