drm/msm/dsi: free TX buffer in unbind
authorDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Thu, 12 Oct 2023 01:29:09 +0000 (04:29 +0300)
committerRob Clark <robdclark@chromium.org>
Mon, 16 Oct 2023 14:27:33 +0000 (07:27 -0700)
commit5e05be78264594634860087953649487f486ffcc
tree665abc8fe23df1dad35359622a1a166d534dd77a
parent69b321b2c3df4f7e51a9de587e41f324b0b717b0
drm/msm/dsi: free TX buffer in unbind

If the drm/msm init code gets an error during output modeset
initialisation, the kernel will report an error regarding DRM memory
manager not being clean during shutdown. This is because
msm_dsi_modeset_init() allocates a piece of GEM memory for the TX
buffer, but destruction of the buffer happens only at
msm_dsi_host_destroy(), which is called during DSI driver's remove()
time, much later than the DRM MM shutdown.

To solve this issue, move the TX buffer destruction to dsi_unbind(), so
that the buffer is destructed at the correct time. Note, we also have to
store a reference to the address space, because priv->kms->aspace is
cleared before components are unbound.

Reported-by: Bjorn Andersson <andersson@kernel.org>
Fixes: 8f59ee9a570c ("drm/msm/dsi: Adjust probe order")
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Patchwork: https://patchwork.freedesktop.org/patch/562238/
Signed-off-by: Rob Clark <robdclark@chromium.org>
drivers/gpu/drm/msm/dsi/dsi.c
drivers/gpu/drm/msm/dsi/dsi.h
drivers/gpu/drm/msm/dsi/dsi_host.c