Commit 859f2c0d authored by Ilija Hadzic's avatar Ilija Hadzic Committed by Ben Hutchings

drm: restore open_count if drm_setup fails

commit 0f1cb1bd upstream.

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: default avatarIlija Hadzic <ihadzic@research.bell-labs.com>
Reviewed-by: default avatarThomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent e636bd39
......@@ -136,8 +136,11 @@ int drm_open(struct inode *inode, struct file *filp)
retcode = drm_open_helper(inode, filp, dev);
if (!retcode) {
atomic_inc(&dev->counts[_DRM_STAT_OPENS]);
if (!dev->open_count++)
if (!dev->open_count++) {
retcode = drm_setup(dev);
if (retcode)
dev->open_count--;
}
}
if (!retcode) {
mutex_lock(&dev->struct_mutex);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment