Skip to content
This repository has been archived by the owner on Jul 13, 2022. It is now read-only.

Commit

Permalink
drm: restore open_count if drm_setup fails
Browse files Browse the repository at this point in the history
commit 0f1cb1bd94a9c967cd4ad3de51cfdabe61eb5dcc 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: Ilija Hadzic <ihadzic@research.bell-labs.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
ihadzic authored and gregkh committed Nov 17, 2012
1 parent 4d02840 commit 356c93d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/gpu/drm/drm_fops.c
Expand Up @@ -135,8 +135,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);
Expand Down

0 comments on commit 356c93d

Please sign in to comment.