aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulia Lawall <julia@diku.dk>2008-07-30 01:33:28 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-30 12:41:45 -0400
commit950d442ad053e660538cdaa6efc0e060c2a65062 (patch)
treec980cdf6c6a1a7a0dec19a9368b5445e1fb7db4a
parentd667b6ddbcdc036a27407c8b2c1243f1dfd69e26 (diff)
drivers/video: release mutex in error handling code
The mutex is released on a successful return, so it would seem that it should be released on an error return as well. The semantic patch finds this problem is as follows: (http://www.emn.fr/x-info/coccinelle/) // <smpl> @@ expression l; @@ mutex_lock(l); ... when != mutex_unlock(l) when any when strict ( if (...) { ... when != mutex_unlock(l) + mutex_unlock(l); return ...; } | mutex_unlock(l); ) // </smpl> Signed-off-by: Julia Lawall <julia@diku.dk> Acked-by: Krzysztof Helt <krzysztof.h1@wp.pl> Acked-by: Ondrej Zajicek <santiago@crfreenet.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--drivers/video/arkfb.c9
-rw-r--r--drivers/video/vt8623fb.c9
2 files changed, 6 insertions, 12 deletions
diff --git a/drivers/video/arkfb.c b/drivers/video/arkfb.c
index 5001bd4ef466..38a1e8308c83 100644
--- a/drivers/video/arkfb.c
+++ b/drivers/video/arkfb.c
@@ -1126,11 +1126,8 @@ static int ark_pci_resume (struct pci_dev* dev)
1126 acquire_console_sem(); 1126 acquire_console_sem();
1127 mutex_lock(&(par->open_lock)); 1127 mutex_lock(&(par->open_lock));
1128 1128
1129 if (par->ref_count == 0) { 1129 if (par->ref_count == 0)
1130 mutex_unlock(&(par->open_lock)); 1130 goto fail;
1131 release_console_sem();
1132 return 0;
1133 }
1134 1131
1135 pci_set_power_state(dev, PCI_D0); 1132 pci_set_power_state(dev, PCI_D0);
1136 pci_restore_state(dev); 1133 pci_restore_state(dev);
@@ -1143,8 +1140,8 @@ static int ark_pci_resume (struct pci_dev* dev)
1143 arkfb_set_par(info); 1140 arkfb_set_par(info);
1144 fb_set_suspend(info, 0); 1141 fb_set_suspend(info, 0);
1145 1142
1146 mutex_unlock(&(par->open_lock));
1147fail: 1143fail:
1144 mutex_unlock(&(par->open_lock));
1148 release_console_sem(); 1145 release_console_sem();
1149 return 0; 1146 return 0;
1150} 1147}
diff --git a/drivers/video/vt8623fb.c b/drivers/video/vt8623fb.c
index 536ab11623f0..4a484ee98f8a 100644
--- a/drivers/video/vt8623fb.c
+++ b/drivers/video/vt8623fb.c
@@ -853,11 +853,8 @@ static int vt8623_pci_resume(struct pci_dev* dev)
853 acquire_console_sem(); 853 acquire_console_sem();
854 mutex_lock(&(par->open_lock)); 854 mutex_lock(&(par->open_lock));
855 855
856 if (par->ref_count == 0) { 856 if (par->ref_count == 0)
857 mutex_unlock(&(par->open_lock)); 857 goto fail;
858 release_console_sem();
859 return 0;
860 }
861 858
862 pci_set_power_state(dev, PCI_D0); 859 pci_set_power_state(dev, PCI_D0);
863 pci_restore_state(dev); 860 pci_restore_state(dev);
@@ -870,8 +867,8 @@ static int vt8623_pci_resume(struct pci_dev* dev)
870 vt8623fb_set_par(info); 867 vt8623fb_set_par(info);
871 fb_set_suspend(info, 0); 868 fb_set_suspend(info, 0);
872 869
873 mutex_unlock(&(par->open_lock));
874fail: 870fail:
871 mutex_unlock(&(par->open_lock));
875 release_console_sem(); 872 release_console_sem();
876 873
877 return 0; 874 return 0;