diff options
-rw-r--r-- | drivers/gpu/drm/drm_stub.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c index d009661781bc..1b3e0ff57b45 100644 --- a/drivers/gpu/drm/drm_stub.c +++ b/drivers/gpu/drm/drm_stub.c | |||
@@ -159,6 +159,9 @@ void drm_master_put(struct drm_master **master) | |||
159 | int drm_setmaster_ioctl(struct drm_device *dev, void *data, | 159 | int drm_setmaster_ioctl(struct drm_device *dev, void *data, |
160 | struct drm_file *file_priv) | 160 | struct drm_file *file_priv) |
161 | { | 161 | { |
162 | if (file_priv->is_master) | ||
163 | return 0; | ||
164 | |||
162 | if (file_priv->minor->master && file_priv->minor->master != file_priv->master) | 165 | if (file_priv->minor->master && file_priv->minor->master != file_priv->master) |
163 | return -EINVAL; | 166 | return -EINVAL; |
164 | 167 | ||
@@ -169,6 +172,7 @@ int drm_setmaster_ioctl(struct drm_device *dev, void *data, | |||
169 | file_priv->minor->master != file_priv->master) { | 172 | file_priv->minor->master != file_priv->master) { |
170 | mutex_lock(&dev->struct_mutex); | 173 | mutex_lock(&dev->struct_mutex); |
171 | file_priv->minor->master = drm_master_get(file_priv->master); | 174 | file_priv->minor->master = drm_master_get(file_priv->master); |
175 | file_priv->is_master = 1; | ||
172 | mutex_unlock(&dev->struct_mutex); | 176 | mutex_unlock(&dev->struct_mutex); |
173 | } | 177 | } |
174 | 178 | ||
@@ -178,10 +182,12 @@ int drm_setmaster_ioctl(struct drm_device *dev, void *data, | |||
178 | int drm_dropmaster_ioctl(struct drm_device *dev, void *data, | 182 | int drm_dropmaster_ioctl(struct drm_device *dev, void *data, |
179 | struct drm_file *file_priv) | 183 | struct drm_file *file_priv) |
180 | { | 184 | { |
181 | if (!file_priv->master) | 185 | if (!file_priv->is_master) |
182 | return -EINVAL; | 186 | return -EINVAL; |
187 | |||
183 | mutex_lock(&dev->struct_mutex); | 188 | mutex_lock(&dev->struct_mutex); |
184 | drm_master_put(&file_priv->minor->master); | 189 | drm_master_put(&file_priv->minor->master); |
190 | file_priv->is_master = 0; | ||
185 | mutex_unlock(&dev->struct_mutex); | 191 | mutex_unlock(&dev->struct_mutex); |
186 | return 0; | 192 | return 0; |
187 | } | 193 | } |