From 1d5dbde5221f396a90ffc83cd642861fe885c41c Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Fri, 2 Feb 2024 11:28:20 -0800 Subject: [PATCH] freedreno/drm: Fix teardown crash harder We need to unref the device *after* submit cleanup, so that fd_submit_sp_destory() can still reference the device. Fixes: d558cb664a68 ("freedreno/drm: Submit should hold ref to device") Signed-off-by: Rob Clark Part-of: --- src/freedreno/drm/freedreno_ringbuffer.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/freedreno/drm/freedreno_ringbuffer.c b/src/freedreno/drm/freedreno_ringbuffer.c index 310fa3f3dc3..2bc4cad87ec 100644 --- a/src/freedreno/drm/freedreno_ringbuffer.c +++ b/src/freedreno/drm/freedreno_ringbuffer.c @@ -49,10 +49,13 @@ fd_submit_del(struct fd_submit *submit) if (submit->primary) fd_ringbuffer_del(submit->primary); - fd_pipe_del(submit->pipe); - fd_device_del(submit->dev); + struct fd_pipe *pipe = submit->pipe; + struct fd_device *dev = submit->dev; submit->funcs->destroy(submit); + + fd_pipe_del(pipe); + fd_device_del(dev); } struct fd_submit *