[PATCH 4/4] drm/client: Do not free client memory by default
Thomas Zimmermann
tzimmermann at suse.de
Thu Oct 9 06:16:31 PDT 2025
Make no assumption on the allocation of the client's memory. For
example, amdgpu stores a client within another data structures,
where it cannot be freed by itself.
The correct place to free the client's memory is the client's free
callback. All existing clients implement this.
Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
---
drivers/gpu/drm/drm_client_event.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/drm_client_event.c b/drivers/gpu/drm/drm_client_event.c
index c83196ad8b59..f36fe0392ce6 100644
--- a/drivers/gpu/drm/drm_client_event.c
+++ b/drivers/gpu/drm/drm_client_event.c
@@ -39,12 +39,13 @@ void drm_client_dev_unregister(struct drm_device *dev)
mutex_lock(&dev->clientlist_mutex);
list_for_each_entry_safe(client, tmp, &dev->clientlist, list) {
list_del(&client->list);
- if (client->funcs && client->funcs->unregister) {
+ /*
+ * Unregistering consumes and frees the client.
+ */
+ if (client->funcs && client->funcs->unregister)
client->funcs->unregister(client);
- } else {
+ else
drm_client_release(client);
- kfree(client);
- }
}
mutex_unlock(&dev->clientlist_mutex);
}
--
2.51.0
More information about the linux-arm-kernel
mailing list