[PATCH] drm/stm: remove conflicting framebuffers

From: Yannick Fertre
Date: Fri Dec 03 2021 - 03:56:22 EST


In case of using simplefb or another conflicting framebuffer,
call drm_aperture_remove_framebuffers() to remove memory allocated.

Signed-off-by: Yannick Fertre <yannick.fertre@xxxxxxxxxxx>
---
drivers/gpu/drm/stm/drv.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/drivers/gpu/drm/stm/drv.c b/drivers/gpu/drm/stm/drv.c
index 222869b232ae..5ba46f70f081 100644
--- a/drivers/gpu/drm/stm/drv.c
+++ b/drivers/gpu/drm/stm/drv.c
@@ -14,6 +14,7 @@
#include <linux/of_platform.h>
#include <linux/pm_runtime.h>

+#include <drm/drm_aperture.h>
#include <drm/drm_atomic.h>
#include <drm/drm_atomic_helper.h>
#include <drm/drm_drv.h>
@@ -193,6 +194,10 @@ static int stm_drm_platform_probe(struct platform_device *pdev)
if (ret)
goto err_put;

+ ret = drm_aperture_remove_framebuffers(false, &drv_driver);
+ if (ret)
+ goto err_put;
+
ret = drm_dev_register(ddev, 0);
if (ret)
goto err_put;
--
2.17.1