diff options
author | Emil Velikov <emil.velikov@collabora.com> | 2019-01-14 11:44:09 +0300 |
---|---|---|
committer | Emil Velikov <emil.l.velikov@gmail.com> | 2019-02-13 20:39:32 +0300 |
commit | e21710a893c8705360b764fa44061d72d65fb2ae (patch) | |
tree | 74fdc7f85c35c7a9f0e33b29271a4183f85056d7 /drivers/gpu/drm/drm_file.c | |
parent | 4933c9a494416a8edc3166ce3f3ce3836a6af01d (diff) | |
download | linux-e21710a893c8705360b764fa44061d72d65fb2ae.tar.xz |
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
Diffstat (limited to 'drivers/gpu/drm/drm_file.c')
-rw-r--r-- | drivers/gpu/drm/drm_file.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/drivers/gpu/drm/drm_file.c b/drivers/gpu/drm/drm_file.c index 46f48f245eb5..e9607acfb629 100644 --- a/drivers/gpu/drm/drm_file.c +++ b/drivers/gpu/drm/drm_file.c @@ -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); |