Skip to content

Commit 971740a

Browse files
committed
drm: Warn when freeing a framebuffer that's still on a list
Sprinkle some extra WARNs around so that we might catch premature framebuffer destruction more readily. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20231211081625.25704-2-ville.syrjala@linux.intel.com Acked-by: Javier Martinez Canillas <javierm@redhat.com>
1 parent cb4daf2 commit 971740a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/gpu/drm/drm_framebuffer.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,7 @@ int drm_mode_rmfb(struct drm_device *dev, u32 fb_id,
461461

462462
INIT_WORK_ONSTACK(&arg.work, drm_mode_rmfb_work_fn);
463463
INIT_LIST_HEAD(&arg.fbs);
464+
drm_WARN_ON(dev, !list_empty(&fb->filp_head));
464465
list_add_tail(&fb->filp_head, &arg.fbs);
465466

466467
schedule_work(&arg.work);
@@ -827,6 +828,8 @@ void drm_framebuffer_free(struct kref *kref)
827828
container_of(kref, struct drm_framebuffer, base.refcount);
828829
struct drm_device *dev = fb->dev;
829830

831+
drm_WARN_ON(dev, !list_empty(&fb->filp_head));
832+
830833
/*
831834
* The lookup idr holds a weak reference, which has not necessarily been
832835
* removed at this point. Check for that.
@@ -1119,7 +1122,7 @@ void drm_framebuffer_remove(struct drm_framebuffer *fb)
11191122

11201123
dev = fb->dev;
11211124

1122-
WARN_ON(!list_empty(&fb->filp_head));
1125+
drm_WARN_ON(dev, !list_empty(&fb->filp_head));
11231126

11241127
/*
11251128
* drm ABI mandates that we remove any deleted framebuffers from active

0 commit comments

Comments
 (0)