aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/drm/drm_fops.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c
index 08d14df3bb42..4804872f8b19 100644
--- a/drivers/gpu/drm/drm_fops.c
+++ b/drivers/gpu/drm/drm_fops.c
@@ -140,14 +140,16 @@ int drm_open(struct inode *inode, struct file *filp)
140 spin_unlock(&dev->count_lock); 140 spin_unlock(&dev->count_lock);
141 } 141 }
142out: 142out:
143 mutex_lock(&dev->struct_mutex); 143 if (!retcode) {
144 if (minor->type == DRM_MINOR_LEGACY) { 144 mutex_lock(&dev->struct_mutex);
145 BUG_ON((dev->dev_mapping != NULL) && 145 if (minor->type == DRM_MINOR_LEGACY) {
146 (dev->dev_mapping != inode->i_mapping)); 146 if (dev->dev_mapping == NULL)
147 if (dev->dev_mapping == NULL) 147 dev->dev_mapping = inode->i_mapping;
148 dev->dev_mapping = inode->i_mapping; 148 else if (dev->dev_mapping != inode->i_mapping)
149 retcode = -ENODEV;
150 }
151 mutex_unlock(&dev->struct_mutex);
149 } 152 }
150 mutex_unlock(&dev->struct_mutex);
151 153
152 return retcode; 154 return retcode;
153} 155}