Patchwork [3.5.y.z,extended,stable] Patch "drm: restore open_count if drm_setup fails" has been added to staging queue

mail settings
Submitter Herton Ronaldo Krzesinski
Date Dec. 6, 2012, 3:24 a.m.
Message ID <>
Download mbox | patch
Permalink /patch/204108/
State New
Headers show


Herton Ronaldo Krzesinski - Dec. 6, 2012, 3:24 a.m.
This is a note to let you know that I have just added a patch titled

    drm: restore open_count if drm_setup fails

to the linux-3.5.y-queue branch of the 3.5.y.z extended stable tree 
which can be found at:;a=shortlog;h=refs/heads/linux-3.5.y-queue

If you, or anyone else, feels it should not be added to this tree, please 
reply to this email.

For more information about the 3.5.y.z tree, see



From db85fe160824db367b870d2028a8932ac2eb5eab Mon Sep 17 00:00:00 2001
From: Ilija Hadzic <>
Date: Mon, 29 Oct 2012 17:35:00 +0000
Subject: [PATCH] drm: restore open_count if drm_setup fails
X-Extended-Stable: 3.5

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 <>
Reviewed-by: Thomas Hellstrom <>
Signed-off-by: Dave Airlie <>
Signed-off-by: Herton Ronaldo Krzesinski <>
 drivers/gpu/drm/drm_fops.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)



diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c
index 123de28..b90abff 100644
--- a/drivers/gpu/drm/drm_fops.c
+++ b/drivers/gpu/drm/drm_fops.c
@@ -139,8 +139,11 @@  int drm_open(struct inode *inode, struct file *filp)
 	retcode = drm_open_helper(inode, filp, dev);
 	if (!retcode) {
-		if (!dev->open_count++)
+		if (!dev->open_count++) {
 			retcode = drm_setup(dev);
+			if (retcode)
+				dev->open_count--;
+		}
 	if (!retcode) {