[Intel-gfx] [PATCH] video/fbdev: Warn when we try to free a registered framebuffer

Chris Wilson chris at chris-wilson.co.uk
Mon Sep 3 16:51:59 UTC 2018


Just a tool for CI to emit the stacktrace of who is lost track of their
framebuffers and tried to free it before unregistering it.

References: https://bugs.freedesktop.org/show_bug.cgi?id=107712
Cc: Daniel Vetter <daniel.vetter at ffwll.ch>
---
Would be useful to keep in core-for-CI as a debug aide.
---
 drivers/video/fbdev/core/fbsysfs.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/video/fbdev/core/fbsysfs.c b/drivers/video/fbdev/core/fbsysfs.c
index e31a182b42bf..de3afba984c7 100644
--- a/drivers/video/fbdev/core/fbsysfs.c
+++ b/drivers/video/fbdev/core/fbsysfs.c
@@ -83,6 +83,11 @@ void framebuffer_release(struct fb_info *info)
 {
 	if (!info)
 		return;
+
+	if (WARN(atomic_read(&info->count),
+		 "framebuffer is still registered, leaking fb_info!\n"))
+		return;
+
 	kfree(info->apertures);
 	kfree(info);
 }
-- 
2.19.0.rc1



More information about the Intel-gfx mailing list