ttyprintk: Fix wrong tty_unregister_driver() call in the error path

ttyprintk driver calls tty_unregister_driver() wrongly in the error
path of tty_register_driver().  Also, setting ttyprintk_driver to NULL
is utterly superfluous, so let's get rid of it, too.

Reported-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Takashi Iwai 2014-04-02 14:45:21 +02:00 committed by Greg Kroah-Hartman
parent f4f653e987
commit 7d1c2858c4

View File

@ -210,10 +210,8 @@ static int __init ttyprintk_init(void)
return 0; return 0;
error: error:
tty_unregister_driver(ttyprintk_driver);
put_tty_driver(ttyprintk_driver); put_tty_driver(ttyprintk_driver);
tty_port_destroy(&tpk_port.port); tty_port_destroy(&tpk_port.port);
ttyprintk_driver = NULL;
return ret; return ret;
} }
device_initcall(ttyprintk_init); device_initcall(ttyprintk_init);