drm/vc4: bo: Fix drmm_mutex_init memory hog
authorMaxime Ripard <maxime@cerno.tech>
Wed, 11 Jan 2023 10:57:01 +0000 (11:57 +0100)
committerPhil Elwell <8911409+pelwell@users.noreply.github.com>
Wed, 11 Jan 2023 16:53:47 +0000 (16:53 +0000)
commit470cf28a13af2474a8f999e9470d841386e3a3a6
tree1cef120be75d6b774dc3eb61c254860401608e11
parentd1d8e54defd22f2c4da71f1e9ce170f0e712bd41
drm/vc4: bo: Fix drmm_mutex_init memory hog

Commit 374146cad469 ("drm/vc4: Switch to drmm_mutex_init") converted,
among other functions, vc4_create_object() to use drmm_mutex_init().

However, that function is used to allocate a BO, and therefore the
mutex needs to be freed much sooner than when the DRM device is removed
from the system.

For each buffer allocation we thus end up allocating a small structure
as part of the DRM-managed mechanism that is never freed, eventually
leading us to no longer having any free memory anymore.

Let's switch back to mutex_init/mutex_destroy to deal with it properly.

Fixes: 374146cad469 ("drm/vc4: Switch to drmm_mutex_init")
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
drivers/gpu/drm/vc4/vc4_bo.c