diff options
| author | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-08-06 13:13:54 -0400 |
|---|---|---|
| committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-08-06 13:13:54 -0400 |
| commit | 11e4afb49b7fa1fc8e1ffd850c1806dd86a08204 (patch) | |
| tree | 9e57efcb106ae912f7bec718feb3f8ec607559bb /drivers/gpu/drm/drm_fops.c | |
| parent | 162500b3a3ff39d941d29db49b41a16667ae44f0 (diff) | |
| parent | 9b2a606d3898fcb2eedb6faded3bb37549590ac4 (diff) | |
Merge branches 'gemini' and 'misc' into devel
Diffstat (limited to 'drivers/gpu/drm/drm_fops.c')
| -rw-r--r-- | drivers/gpu/drm/drm_fops.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c index 08d14df3bb42..e7aace20981f 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 | ||
| 41 | static int drm_open_helper(struct inode *inode, struct file *filp, | 42 | static 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 | } |
| 142 | out: | 143 | out: |
| 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 | } |
| @@ -240,11 +243,10 @@ static int drm_open_helper(struct inode *inode, struct file *filp, | |||
| 240 | 243 | ||
| 241 | DRM_DEBUG("pid = %d, minor = %d\n", task_pid_nr(current), minor_id); | 244 | DRM_DEBUG("pid = %d, minor = %d\n", task_pid_nr(current), minor_id); |
| 242 | 245 | ||
| 243 | priv = kmalloc(sizeof(*priv), GFP_KERNEL); | 246 | priv = kzalloc(sizeof(*priv), GFP_KERNEL); |
| 244 | if (!priv) | 247 | if (!priv) |
| 245 | return -ENOMEM; | 248 | return -ENOMEM; |
| 246 | 249 | ||
| 247 | memset(priv, 0, sizeof(*priv)); | ||
| 248 | filp->private_data = priv; | 250 | filp->private_data = priv; |
| 249 | priv->filp = filp; | 251 | priv->filp = filp; |
| 250 | priv->uid = current_euid(); | 252 | priv->uid = current_euid(); |
