提交 eea5fd11 编写于 作者: D Daeseok Youn 提交者: Greg Kroah-Hartman

staging: dgnc: introduce the dgnc_tty_unregister()

The dgnc_tty_unregister() will be called when
the dgnc_tty_register() is failed.
Signed-off-by: NDaeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 f20ae478
......@@ -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);
......
......@@ -273,6 +273,14 @@ int dgnc_tty_register(struct dgnc_board *brd)
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()
*
......
......@@ -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 *);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册