diff options
Diffstat (limited to 'drivers/gpu/drm/drm_fops.c')
-rw-r--r-- | drivers/gpu/drm/drm_fops.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c index 0d55552e1302..9d532d7fdf59 100644 --- a/drivers/gpu/drm/drm_fops.c +++ b/drivers/gpu/drm/drm_fops.c | |||
@@ -141,14 +141,16 @@ int drm_open(struct inode *inode, struct file *filp) | |||
141 | spin_unlock(&dev->count_lock); | 141 | spin_unlock(&dev->count_lock); |
142 | } | 142 | } |
143 | out: | 143 | out: |
144 | mutex_lock(&dev->struct_mutex); | 144 | if (!retcode) { |
145 | if (minor->type == DRM_MINOR_LEGACY) { | 145 | mutex_lock(&dev->struct_mutex); |
146 | BUG_ON((dev->dev_mapping != NULL) && | 146 | if (minor->type == DRM_MINOR_LEGACY) { |
147 | (dev->dev_mapping != inode->i_mapping)); | 147 | if (dev->dev_mapping == NULL) |
148 | if (dev->dev_mapping == NULL) | 148 | dev->dev_mapping = inode->i_mapping; |
149 | 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); | ||
150 | } | 153 | } |
151 | mutex_unlock(&dev->struct_mutex); | ||
152 | 154 | ||
153 | return retcode; | 155 | return retcode; |
154 | } | 156 | } |