]> git.karo-electronics.de Git - linux-beck.git/commitdiff
staging: dgnc: introduce the dgnc_tty_unregister()
authorDaeseok Youn <daeseok.youn@gmail.com>
Mon, 26 Sep 2016 00:43:51 +0000 (09:43 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 27 Sep 2016 11:12:26 +0000 (13:12 +0200)
The dgnc_tty_unregister() will be called when
the dgnc_tty_register() is failed.

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/dgnc/dgnc_driver.c
drivers/staging/dgnc/dgnc_tty.c
drivers/staging/dgnc/dgnc_tty.h

index a95d13c7ef30f0c95c5427f68a9334b038ea33ed..ffe55a239f4e92892e861139056241825fdca824 100644 (file)
@@ -299,13 +299,13 @@ static int dgnc_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
        rc = dgnc_finalize_board_init(brd);
        if (rc < 0) {
                pr_err(DRVSTR ": Can't finalize board init (%d)\n", rc);
-               goto failed;
+               goto unregister_tty;
        }
 
        rc = dgnc_tty_init(brd);
        if (rc < 0) {
                pr_err(DRVSTR ": Can't init tty devices (%d)\n", rc);
-               goto failed;
+               goto unregister_tty;
        }
 
        brd->state = BOARD_READY;
@@ -317,6 +317,9 @@ static int dgnc_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 
        return 0;
 
+unregister_tty:
+       dgnc_tty_unregister(brd);
+
 failed:
        kfree(brd);
 
index 1c1ac8427b6ed797dce3628a4ba17e6f52ef94dd..4f781955726b3f5f21e2f1a341afe032d82176f7 100644 (file)
@@ -273,6 +273,14 @@ free_serial_driver:
        return rc;
 }
 
+void dgnc_tty_unregister(struct dgnc_board *brd)
+{
+       tty_unregister_driver(brd->print_driver);
+       tty_unregister_driver(brd->serial_driver);
+       put_tty_driver(brd->print_driver);
+       put_tty_driver(brd->serial_driver);
+}
+
 /*
  * dgnc_tty_init()
  *
index 21d3369b875ce147fcf6285ecd996e970b3958c1..f065c8fff1b0ee45ee50baf6cf8d0ccbfde1bcfa 100644 (file)
@@ -19,6 +19,7 @@
 #include "dgnc_driver.h"
 
 int    dgnc_tty_register(struct dgnc_board *brd);
+void dgnc_tty_unregister(struct dgnc_board *brd);
 
 int    dgnc_tty_preinit(void);
 int     dgnc_tty_init(struct dgnc_board *);