summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_file.c
diff options
context:
space:
mode:
authorSean Paul <seanpaul@chromium.org>2019-03-06 15:22:18 +0100
committerSean Paul <seanpaul@chromium.org>2019-03-06 15:22:18 +0100
commitcd7d3a1bb42e0756b17ccfafbd956ca7ed757846 (patch)
treefb76fd0ccaaaa3f27ef0a06ecf3d04ebe9d4025d /drivers/gpu/drm/drm_file.c
parentdrm/vc4: Add a debugfs entry to disable/enable the load tracker (diff)
parentMerge tag 'drm-misc-fixes-2019-02-22' of git://anongit.freedesktop.org/drm/dr... (diff)
downloadlinux-cd7d3a1bb42e0756b17ccfafbd956ca7ed757846.tar.xz
linux-cd7d3a1bb42e0756b17ccfafbd956ca7ed757846.zip
Merge drm/drm-next into drm-misc-next
Picking up v5.0 + missed misc-fixes from last release Signed-off-by: Sean Paul <seanpaul@chromium.org>
Diffstat (limited to 'drivers/gpu/drm/drm_file.c')
-rw-r--r--drivers/gpu/drm/drm_file.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/drivers/gpu/drm/drm_file.c b/drivers/gpu/drm/drm_file.c
index f782d3103d29..9701469a6e93 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;
@@ -318,8 +330,10 @@ int drm_open(struct inode *inode, struct file *filp)
goto err_undo;
if (need_setup) {
retcode = drm_setup(dev);
- if (retcode)
+ if (retcode) {
+ drm_close_helper(filp);
goto err_undo;
+ }
}
return 0;
@@ -473,11 +487,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);