From: Thomas Zimmermann <tzimmermann@suse.de>
To: jfalempe@redhat.com, javierm@redhat.com, mripard@kernel.org,
maarten.lankhorst@linux.intel.com
Cc: dri-devel@lists.freedesktop.org,
linux-arm-kernel@lists.infradead.org,
linux-samsung-soc@vger.kernel.org,
intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org,
linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org,
amd-gfx@lists.freedesktop.org, linux-tegra@vger.kernel.org,
Thomas Zimmermann <tzimmermann@suse.de>
Subject: [PATCH 4/4] drm/client: Do not free client memory by default
Date: Thu, 9 Oct 2025 15:16:31 +0200 [thread overview]
Message-ID: <20251009132006.45834-5-tzimmermann@suse.de> (raw)
In-Reply-To: <20251009132006.45834-1-tzimmermann@suse.de>
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@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
next prev parent reply other threads:[~2025-10-09 13:23 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-09 13:16 [PATCH 0/4] drm/client: Implement free callback for fbdev and log Thomas Zimmermann
2025-10-09 13:16 ` [PATCH 1/4] drm/client: Add client free callback to unprepare fb_helper Thomas Zimmermann
2025-10-09 13:32 ` Dmitry Baryshkov
2025-10-21 13:29 ` Tomi Valkeinen
2025-10-21 13:54 ` Patrik Jakobsson
2025-10-23 13:13 ` Thomas Zimmermann
2025-10-23 15:39 ` Thomas Zimmermann
2025-10-09 13:16 ` [PATCH 2/4] drm/log: Do not hold lock across drm_client_release() Thomas Zimmermann
2025-10-15 7:52 ` Jocelyn Falempe
2025-10-09 13:16 ` [PATCH 3/4] drm/log: Add free callback Thomas Zimmermann
2025-10-15 7:53 ` Jocelyn Falempe
2025-10-09 13:16 ` Thomas Zimmermann [this message]
2025-10-15 8:20 ` [PATCH 4/4] drm/client: Do not free client memory by default Jocelyn Falempe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251009132006.45834-5-tzimmermann@suse.de \
--to=tzimmermann@suse.de \
--cc=amd-gfx@lists.freedesktop.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=freedreno@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=javierm@redhat.com \
--cc=jfalempe@redhat.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox