Skip to content

Commit 52a0233

Browse files
committed
drm/log: Add free callback
Free the client memory in the client free callback. Also move the debugging output into the free callback: drm_client_release() puts the reference on the DRM device, so pointers to the device should be considered dangling afterwards. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>> Link: https://lore.kernel.org/r/20251009132006.45834-4-tzimmermann@suse.de
1 parent 33ba21e commit 52a0233

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

drivers/gpu/drm/clients/drm_log.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -293,19 +293,26 @@ static void drm_log_free_scanout(struct drm_client_dev *client)
293293
}
294294
}
295295

296-
static void drm_log_client_unregister(struct drm_client_dev *client)
296+
static void drm_log_client_free(struct drm_client_dev *client)
297297
{
298298
struct drm_log *dlog = client_to_drm_log(client);
299299
struct drm_device *dev = client->dev;
300300

301+
kfree(dlog);
302+
303+
drm_dbg(dev, "Unregistered with drm log\n");
304+
}
305+
306+
static void drm_log_client_unregister(struct drm_client_dev *client)
307+
{
308+
struct drm_log *dlog = client_to_drm_log(client);
309+
301310
unregister_console(&dlog->con);
302311

303312
mutex_lock(&dlog->lock);
304313
drm_log_free_scanout(client);
305314
mutex_unlock(&dlog->lock);
306315
drm_client_release(client);
307-
kfree(dlog);
308-
drm_dbg(dev, "Unregistered with drm log\n");
309316
}
310317

311318
static int drm_log_client_hotplug(struct drm_client_dev *client)
@@ -339,6 +346,7 @@ static int drm_log_client_resume(struct drm_client_dev *client)
339346

340347
static const struct drm_client_funcs drm_log_client_funcs = {
341348
.owner = THIS_MODULE,
349+
.free = drm_log_client_free,
342350
.unregister = drm_log_client_unregister,
343351
.hotplug = drm_log_client_hotplug,
344352
.suspend = drm_log_client_suspend,

0 commit comments

Comments
 (0)