mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
UPSTREAM: drm: factor out drm_close_helper() function
Will be used to plug an existing memory leak.
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20190114084410.15266-1-emil.l.velikov@gmail.com
(cherry picked from commit e21710a893)
Bug: 152417756
Signed-off-by: Alistair Delva <adelva@google.com>
Change-Id: Id2ec9a880b3a636e2d1d73d85cb5ff2e8614725e
This commit is contained in:
committed by
Alistair Delva
parent
8dd22d7e90
commit
89e8a2f6f5
@@ -262,6 +262,18 @@ void drm_file_free(struct drm_file *file)
|
||||
kfree(file);
|
||||
}
|
||||
|
||||
static void drm_close_helper(struct file *filp)
|
||||
{
|
||||
struct drm_file *file_priv = filp->private_data;
|
||||
struct drm_device *dev = file_priv->minor->dev;
|
||||
|
||||
mutex_lock(&dev->filelist_mutex);
|
||||
list_del(&file_priv->lhead);
|
||||
mutex_unlock(&dev->filelist_mutex);
|
||||
|
||||
drm_file_free(file_priv);
|
||||
}
|
||||
|
||||
static int drm_setup(struct drm_device * dev)
|
||||
{
|
||||
int ret;
|
||||
@@ -473,11 +485,7 @@ int drm_release(struct inode *inode, struct file *filp)
|
||||
|
||||
DRM_DEBUG("open_count = %d\n", dev->open_count);
|
||||
|
||||
mutex_lock(&dev->filelist_mutex);
|
||||
list_del(&file_priv->lhead);
|
||||
mutex_unlock(&dev->filelist_mutex);
|
||||
|
||||
drm_file_free(file_priv);
|
||||
drm_close_helper(filp);
|
||||
|
||||
if (!--dev->open_count)
|
||||
drm_lastclose(dev);
|
||||
|
||||
Reference in New Issue
Block a user