From: akpm@linux-foundation.org Subject: [patch 1/5] gpu: vga_switcheroo, fix lock imbalance Date: Tue, 27 Apr 2010 14:11:03 -0700 Message-ID: <201004272111.o3RLB3j1019952@imap1.linux-foundation.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.sourceforge.net To: airlied@linux.ie Cc: airlied@redhat.com, akpm@linux-foundation.org, dri-devel@lists.sourceforge.net, jslaby@suse.cz List-Id: dri-devel@lists.freedesktop.org From: Jiri Slaby Stanse found that one error path in vga_switcheroo_debugfs_write omits to unlock vgasr_mutex. Fix that. Signed-off-by: Jiri Slaby Cc: Dave Airlie Signed-off-by: Andrew Morton --- drivers/gpu/vga/vga_switcheroo.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff -puN drivers/gpu/vga/vga_switcheroo.c~gpu-vga_switcheroo-fix-lock-imbalance drivers/gpu/vga/vga_switcheroo.c --- a/drivers/gpu/vga/vga_switcheroo.c~gpu-vga_switcheroo-fix-lock-imbalance +++ a/drivers/gpu/vga/vga_switcheroo.c @@ -276,8 +276,10 @@ vga_switcheroo_debugfs_write(struct file mutex_lock(&vgasr_mutex); - if (!vgasr_priv.active) - return -EINVAL; + if (!vgasr_priv.active) { + cnt = -EINVAL; + goto out; + } /* pwr off the device not in use */ if (strncmp(usercmd, "OFF", 3) == 0) { _ ------------------------------------------------------------------------------ --