aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_fops.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/drm_fops.c')
-rw-r--r--drivers/gpu/drm/drm_fops.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c
index 08d14df3bb42..9d532d7fdf59 100644
--- a/drivers/gpu/drm/drm_fops.c
+++ b/drivers/gpu/drm/drm_fops.c
@@ -36,6 +36,7 @@
36 36
37#include "drmP.h" 37#include "drmP.h"
38#include <linux/poll.h> 38#include <linux/poll.h>
39#include <linux/slab.h>
39#include <linux/smp_lock.h> 40#include <linux/smp_lock.h>
40 41
41static int drm_open_helper(struct inode *inode, struct file *filp, 42static int drm_open_helper(struct inode *inode, struct file *filp,
@@ -140,14 +141,16 @@ int drm_open(struct inode *inode, struct file *filp)
140 spin_unlock(&dev->count_lock); 141 spin_unlock(&dev->count_lock);
141 } 142 }
142out: 143out:
143 mutex_lock(&dev->struct_mutex); 144 if (!retcode) {
144 if (minor->type == DRM_MINOR_LEGACY) { 145 mutex_lock(&dev->struct_mutex);
145 BUG_ON((dev->dev_mapping != NULL) && 146 if (minor->type == DRM_MINOR_LEGACY) {
146 (dev->dev_mapping != inode->i_mapping)); 147 if (dev->dev_mapping == NULL)
147 if (dev->dev_mapping == NULL) 148 dev->dev_mapping = inode->i_mapping;
148 dev->dev_mapping = inode->i_mapping; 149 else if (dev->dev_mapping != inode->i_mapping)
150 retcode = -ENODEV;
151 }
152 mutex_unlock(&dev->struct_mutex);
149 } 153 }
150 mutex_unlock(&dev->struct_mutex);
151 154
152 return retcode; 155 return retcode;
153} 156}