ttyprintk: Fix wrong tty_unregister_driver() call in the error path
authorTakashi Iwai <tiwai@suse.de>
Wed, 2 Apr 2014 12:45:21 +0000 (14:45 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 16 Apr 2014 21:21:06 +0000 (14:21 -0700)
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>
drivers/char/ttyprintk.c

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