]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm/vmwgfx: Merge vmw_bo_release and vmw_bo_free functions
authorIan Forbes <ian.forbes@broadcom.com>
Wed, 7 Jan 2026 15:20:59 +0000 (09:20 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 23 Jan 2026 10:18:36 +0000 (11:18 +0100)
[ Upstream commit 37a0cff4551c14aca4cfa6ef3f2f0e0f61d66825 ]

Some of the warnings need to be reordered between these two functions
in order to be correct. This has happened multiple times.
Merging them solves this problem once and for all.

Fixes: d6667f0ddf46 ("drm/vmwgfx: Fix handling of dumb buffers")
Signed-off-by: Ian Forbes <ian.forbes@broadcom.com>
Signed-off-by: Zack Rusin <zack.rusin@broadcom.com>
Link: https://patch.msgid.link/20260107152059.3048329-1-ian.forbes@broadcom.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/vmwgfx/vmwgfx_bo.c

index e8e49f13cfa2ce23bedf349df75c18b4cec42b75..86834005de71354dda60c0f3fd47cac389f61e2b 100644 (file)
 
 #include <drm/ttm/ttm_placement.h>
 
-static void vmw_bo_release(struct vmw_bo *vbo)
+/**
+ * vmw_bo_free - vmw_bo destructor
+ *
+ * @bo: Pointer to the embedded struct ttm_buffer_object
+ */
+static void vmw_bo_free(struct ttm_buffer_object *bo)
 {
        struct vmw_resource *res;
+       struct vmw_bo *vbo = to_vmw_bo(&bo->base);
 
        WARN_ON(vbo->tbo.base.funcs &&
                kref_read(&vbo->tbo.base.refcount) != 0);
@@ -63,20 +69,8 @@ static void vmw_bo_release(struct vmw_bo *vbo)
                }
                vmw_surface_unreference(&vbo->dumb_surface);
        }
-       drm_gem_object_release(&vbo->tbo.base);
-}
-
-/**
- * vmw_bo_free - vmw_bo destructor
- *
- * @bo: Pointer to the embedded struct ttm_buffer_object
- */
-static void vmw_bo_free(struct ttm_buffer_object *bo)
-{
-       struct vmw_bo *vbo = to_vmw_bo(&bo->base);
-
        WARN_ON(!RB_EMPTY_ROOT(&vbo->res_tree));
-       vmw_bo_release(vbo);
+       drm_gem_object_release(&vbo->tbo.base);
        WARN_ON(vbo->dirty);
        kfree(vbo);
 }