aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorIlija Hadzic <ilijahadzic@gmail.com>2012-10-29 13:35:00 -0400
committerDave Airlie <airlied@redhat.com>2012-11-06 19:51:08 -0500
commit0f1cb1bd94a9c967cd4ad3de51cfdabe61eb5dcc (patch)
tree563f4c28f5049c3bec4ab0c1efaa147098062e46 /drivers/gpu/drm
parent3d70f8c617a436c7146ecb81df2265b4626dfe89 (diff)
drm: restore open_count if drm_setup fails
If drm_setup (called at first open) fails, the whole open call has failed, so we should not keep the open_count incremented. Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com> Cc: stable@vger.kernel.org Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/drm_fops.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c
index 7ef1b673e1be..af68eca44abe 100644
--- a/drivers/gpu/drm/drm_fops.c
+++ b/drivers/gpu/drm/drm_fops.c
@@ -135,8 +135,11 @@ int drm_open(struct inode *inode, struct file *filp)
135 retcode = drm_open_helper(inode, filp, dev); 135 retcode = drm_open_helper(inode, filp, dev);
136 if (!retcode) { 136 if (!retcode) {
137 atomic_inc(&dev->counts[_DRM_STAT_OPENS]); 137 atomic_inc(&dev->counts[_DRM_STAT_OPENS]);
138 if (!dev->open_count++) 138 if (!dev->open_count++) {
139 retcode = drm_setup(dev); 139 retcode = drm_setup(dev);
140 if (retcode)
141 dev->open_count--;
142 }
140 } 143 }
141 if (!retcode) { 144 if (!retcode) {
142 mutex_lock(&dev->struct_mutex); 145 mutex_lock(&dev->struct_mutex);