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>
This commit is contained in:
parent
d667b6ddbc
commit
950d442ad0
|
@ -1126,11 +1126,8 @@ static int ark_pci_resume (struct pci_dev* dev)
|
||||||
acquire_console_sem();
|
acquire_console_sem();
|
||||||
mutex_lock(&(par->open_lock));
|
mutex_lock(&(par->open_lock));
|
||||||
|
|
||||||
if (par->ref_count == 0) {
|
if (par->ref_count == 0)
|
||||||
mutex_unlock(&(par->open_lock));
|
goto fail;
|
||||||
release_console_sem();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
pci_set_power_state(dev, PCI_D0);
|
pci_set_power_state(dev, PCI_D0);
|
||||||
pci_restore_state(dev);
|
pci_restore_state(dev);
|
||||||
|
@ -1143,8 +1140,8 @@ static int ark_pci_resume (struct pci_dev* dev)
|
||||||
arkfb_set_par(info);
|
arkfb_set_par(info);
|
||||||
fb_set_suspend(info, 0);
|
fb_set_suspend(info, 0);
|
||||||
|
|
||||||
mutex_unlock(&(par->open_lock));
|
|
||||||
fail:
|
fail:
|
||||||
|
mutex_unlock(&(par->open_lock));
|
||||||
release_console_sem();
|
release_console_sem();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -853,11 +853,8 @@ static int vt8623_pci_resume(struct pci_dev* dev)
|
||||||
acquire_console_sem();
|
acquire_console_sem();
|
||||||
mutex_lock(&(par->open_lock));
|
mutex_lock(&(par->open_lock));
|
||||||
|
|
||||||
if (par->ref_count == 0) {
|
if (par->ref_count == 0)
|
||||||
mutex_unlock(&(par->open_lock));
|
goto fail;
|
||||||
release_console_sem();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
pci_set_power_state(dev, PCI_D0);
|
pci_set_power_state(dev, PCI_D0);
|
||||||
pci_restore_state(dev);
|
pci_restore_state(dev);
|
||||||
|
@ -870,8 +867,8 @@ static int vt8623_pci_resume(struct pci_dev* dev)
|
||||||
vt8623fb_set_par(info);
|
vt8623fb_set_par(info);
|
||||||
fb_set_suspend(info, 0);
|
fb_set_suspend(info, 0);
|
||||||
|
|
||||||
mutex_unlock(&(par->open_lock));
|
|
||||||
fail:
|
fail:
|
||||||
|
mutex_unlock(&(par->open_lock));
|
||||||
release_console_sem();
|
release_console_sem();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue