Patchwork TTY: hvcs: fix missing unlock on error in hvcs_initialize()

login
register
mail settings
Submitter Wei Yongjun
Date Oct. 22, 2012, 4:42 a.m.
Message ID <CAPgLHd-kHAx5Eb8Jd8iH4=KoCv1mjrtaLWd4D7bWJ2zLQoJe3g@mail.gmail.com>
Download mbox | patch
Permalink /patch/193074/
State Accepted, archived
Headers show

Comments

Wei Yongjun - Oct. 22, 2012, 4:42 a.m.
From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

Add the missing unlock on the error handling path in function
hvcs_initialize().

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
 drivers/tty/hvc/hvcs.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Patch

diff --git a/drivers/tty/hvc/hvcs.c b/drivers/tty/hvc/hvcs.c
index cab5c7a..744c3b8 100644
--- a/drivers/tty/hvc/hvcs.c
+++ b/drivers/tty/hvc/hvcs.c
@@ -1496,8 +1496,10 @@  static int __devinit hvcs_initialize(void)
 		num_ttys_to_alloc = hvcs_parm_num_devs;
 
 	hvcs_tty_driver = alloc_tty_driver(num_ttys_to_alloc);
-	if (!hvcs_tty_driver)
+	if (!hvcs_tty_driver) {
+		mutex_unlock(&hvcs_init_mutex);
 		return -ENOMEM;
+	}
 
 	if (hvcs_alloc_index_list(num_ttys_to_alloc)) {
 		rc = -ENOMEM;