From: Dave Stevenson <dave.stevenson@xxxxxxxxxxxxxxx> Should we go through the timeout failure case with port_disable not returning all buffers for whatever reason, the buffers_with_vpu counter gets left at a non-zero value, which will cause reference counting issues should the instance be reused. Reset the count when the port is enabled again, but before any buffers have been sent to the VPU. Signed-off-by: Dave Stevenson <dave.stevenson@xxxxxxxxxxxxxxx> Signed-off-by: Maarten Vanraes <maarten@xxxxxxxx> --- drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c index 479b8114dcdb..14ecb8e5e2ee 100644 --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c @@ -1483,6 +1483,8 @@ static int port_enable(struct vchiq_mmal_instance *instance, port->enabled = true; + atomic_set(&port->buffers_with_vpu, 0); + if (port->buffer_cb) { /* send buffer headers to videocore */ hdr_count = 1; -- 2.41.0