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.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c
index 6263b0147598..7348a3dab250 100644
--- a/drivers/gpu/drm/drm_fops.c
+++ b/drivers/gpu/drm/drm_fops.c
@@ -133,6 +133,9 @@ int drm_open(struct inode *inode, struct file *filp)
133 if (!(dev = minor->dev)) 133 if (!(dev = minor->dev))
134 return -ENODEV; 134 return -ENODEV;
135 135
136 if (drm_device_is_unplugged(dev))
137 return -ENODEV;
138
136 retcode = drm_open_helper(inode, filp, dev); 139 retcode = drm_open_helper(inode, filp, dev);
137 if (!retcode) { 140 if (!retcode) {
138 atomic_inc(&dev->counts[_DRM_STAT_OPENS]); 141 atomic_inc(&dev->counts[_DRM_STAT_OPENS]);
@@ -181,6 +184,9 @@ int drm_stub_open(struct inode *inode, struct file *filp)
181 if (!(dev = minor->dev)) 184 if (!(dev = minor->dev))
182 goto out; 185 goto out;
183 186
187 if (drm_device_is_unplugged(dev))
188 goto out;
189
184 old_fops = filp->f_op; 190 old_fops = filp->f_op;
185 filp->f_op = fops_get(dev->driver->fops); 191 filp->f_op = fops_get(dev->driver->fops);
186 if (filp->f_op == NULL) { 192 if (filp->f_op == NULL) {
@@ -579,6 +585,8 @@ int drm_release(struct inode *inode, struct file *filp)
579 retcode = -EBUSY; 585 retcode = -EBUSY;
580 } else 586 } else
581 retcode = drm_lastclose(dev); 587 retcode = drm_lastclose(dev);
588 if (drm_device_is_unplugged(dev))
589 drm_put_dev(dev);
582 } 590 }
583 mutex_unlock(&drm_global_mutex); 591 mutex_unlock(&drm_global_mutex);
584 592