[PATCH] accessibility: speakup: unregister tty ldisc on later init failures

Haoxiang Li posted 1 patch 1 week, 5 days ago
drivers/accessibility/speakup/main.c | 1 +
1 file changed, 1 insertion(+)
[PATCH] accessibility: speakup: unregister tty ldisc on later init failures
Posted by Haoxiang Li 1 week, 5 days ago
The ldisc registration is intentionally non-fatal, since some synth
drivers do not use tty/ldisc.  However, once speakup_init() continues
past the registration point and later fails, the init unwind path should
mirror speakup_exit() and call spk_ttyio_unregister_ldisc().

Add the missing unregister call to the error path after synth_release(),
matching the normal module exit cleanup order.

Signed-off-by: Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn>
---
 drivers/accessibility/speakup/main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/accessibility/speakup/main.c b/drivers/accessibility/speakup/main.c
index e68cf1d83787..afd1bf9e3a84 100644
--- a/drivers/accessibility/speakup/main.c
+++ b/drivers/accessibility/speakup/main.c
@@ -2444,6 +2444,7 @@ static int __init speakup_init(void)
 	mutex_lock(&spk_mutex);
 	synth_release();
 	mutex_unlock(&spk_mutex);
+	spk_ttyio_unregister_ldisc();
 	speakup_kobj_exit();
 
 error_kobjects:
-- 
2.25.1