8b7eb58b73527ab8795465aa29b9f525f7c84b8f
[openwrt/staging/ldir.git] /
1 From 10f20f30bb2617ec138ca456b059c164c8a4b03c Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Tue, 21 Sep 2021 17:17:57 +0100
4 Subject: [PATCH] staging: mmal-vchiq: Reset buffers_with_vpu on
5 port_enable
6
7 Should we go through the timeout failure case with port_disable
8 not returning all buffers for whatever reason, the
9 buffers_with_vpu counter gets left at a non-zero value, which
10 will cause reference counting issues should the instance be
11 reused.
12
13 Reset the count when the port is enabled again, but before
14 any buffers have been sent to the VPU.
15
16 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
17 ---
18 drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c | 2 ++
19 1 file changed, 2 insertions(+)
20
21 --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
22 +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
23 @@ -1501,6 +1501,8 @@ static int port_enable(struct vchiq_mmal
24
25 port->enabled = 1;
26
27 + atomic_set(&port->buffers_with_vpu, 0);
28 +
29 if (port->buffer_cb) {
30 /* send buffer headers to videocore */
31 hdr_count = 1;