tty: drop put_tty_driver

put_tty_driver() is an alias for tty_driver_kref_put(). There is no need
for two exported identical functions, therefore switch all users of
old put_tty_driver() to new tty_driver_kref_put() and remove the former
for good.

Cc: Richard Henderson <rth@twiddle.net>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Matt Turner <mattst88@gmail.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Jeff Dike <jdike@addtoit.com>
Cc: Richard Weinberger <richard@nod.at>
Cc: Anton Ivanov <anton.ivanov@cambridgegreys.com>
Cc: Chris Zankel <chris@zankel.net>
Cc: Max Filippov <jcmvbkbc@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Cc: Jens Taprogge <jens.taprogge@taprogge.org>
Cc: Karsten Keil <isdn@linux-pingi.de>
Cc: Scott Branden <scott.branden@broadcom.com>
Cc: Ulf Hansson <ulf.hansson@linaro.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: David Lin <dtwlin@gmail.com>
Cc: Johan Hovold <johan@kernel.org>
Cc: Alex Elder <elder@kernel.org>
Cc: Jiri Slaby <jirislaby@kernel.org>
Cc: Laurentiu Tudor <laurentiu.tudor@nxp.com>
Cc: Jiri Kosina <jikos@kernel.org>
Cc: David Sterba <dsterba@suse.com>
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: NXP Linux Team <linux-imx@nxp.com>
Cc: Oliver Neukum <oneukum@suse.com>
Cc: Felipe Balbi <balbi@kernel.org>
Cc: Mathias Nyman <mathias.nyman@intel.com>
Cc: Marcel Holtmann <marcel@holtmann.org>
Cc: Johan Hedberg <johan.hedberg@gmail.com>
Cc: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Acked-by: Alex Elder <elder@linaro.org>
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Acked-by: Max Filippov <jcmvbkbc@gmail.com>
Acked-by: David Sterba <dsterba@suse.com>
Acked-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Link: https://lore.kernel.org/r/20210723074317.32690-8-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Jiri Slaby 2021-07-23 09:43:16 +02:00 committed by Greg Kroah-Hartman
parent cb9ea618ee
commit 9f90a4ddef
41 changed files with 82 additions and 89 deletions

View File

@ -221,7 +221,7 @@ srmcons_init(void)
tty_port_link_device(&srmcons_singleton.port, driver, 0);
err = tty_register_driver(driver);
if (err) {
put_tty_driver(driver);
tty_driver_kref_put(driver);
tty_port_destroy(&srmcons_singleton.port);
return err;
}

View File

@ -144,7 +144,7 @@ static int __init nfcon_init(void)
res = tty_register_driver(driver);
if (res) {
pr_err("failed to register nfcon tty driver\n");
put_tty_driver(driver);
tty_driver_kref_put(driver);
tty_port_destroy(&nfcon_tty_port);
return res;
}
@ -161,7 +161,7 @@ static void __exit nfcon_exit(void)
{
unregister_console(&nf_console);
tty_unregister_driver(nfcon_tty_driver);
put_tty_driver(nfcon_tty_driver);
tty_driver_kref_put(nfcon_tty_driver);
tty_port_destroy(&nfcon_tty_port);
}

View File

@ -568,7 +568,7 @@ int register_lines(struct line_driver *line_driver,
if (err) {
printk(KERN_ERR "register_lines : can't register %s driver\n",
line_driver->name);
put_tty_driver(driver);
tty_driver_kref_put(driver);
for (i = 0; i < nlines; i++)
tty_port_destroy(&lines[i].port);
return err;

View File

@ -178,7 +178,7 @@ static int __init rs_init(void)
static __exit void rs_exit(void)
{
tty_unregister_driver(serial_driver);
put_tty_driver(serial_driver);
tty_driver_kref_put(serial_driver);
tty_port_destroy(&serial_port);
}

View File

@ -2841,7 +2841,7 @@ static int __init synclink_cs_init(void)
err_unreg_tty:
tty_unregister_driver(serial_driver);
err_put_tty:
put_tty_driver(serial_driver);
tty_driver_kref_put(serial_driver);
err:
return rc;
}
@ -2850,7 +2850,7 @@ static void __exit synclink_cs_exit(void)
{
pcmcia_unregister_driver(&mgslpc_driver);
tty_unregister_driver(serial_driver);
put_tty_driver(serial_driver);
tty_driver_kref_put(serial_driver);
}
module_init(synclink_cs_init);

View File

@ -198,7 +198,7 @@ static int __init ttyprintk_init(void)
return 0;
error:
put_tty_driver(ttyprintk_driver);
tty_driver_kref_put(ttyprintk_driver);
tty_port_destroy(&tpk_port.port);
return ret;
}
@ -206,7 +206,7 @@ static int __init ttyprintk_init(void)
static void __exit ttyprintk_exit(void)
{
tty_unregister_driver(ttyprintk_driver);
put_tty_driver(ttyprintk_driver);
tty_driver_kref_put(ttyprintk_driver);
tty_port_destroy(&tpk_port.port);
}

View File

@ -371,7 +371,7 @@ static int ipoctal_inst_slot(struct ipoctal *ipoctal, unsigned int bus_nr,
res = tty_register_driver(tty);
if (res) {
dev_err(&ipoctal->dev->dev, "Can't register tty driver.\n");
put_tty_driver(tty);
tty_driver_kref_put(tty);
return res;
}
@ -696,7 +696,7 @@ static void __ipoctal_remove(struct ipoctal *ipoctal)
}
tty_unregister_driver(ipoctal->tty_drv);
put_tty_driver(ipoctal->tty_drv);
tty_driver_kref_put(ipoctal->tty_drv);
kfree(ipoctal);
}

View File

@ -1290,7 +1290,7 @@ static int __init capinc_tty_init(void)
err = tty_register_driver(drv);
if (err) {
put_tty_driver(drv);
tty_driver_kref_put(drv);
kfree(capiminors);
printk(KERN_ERR "Couldn't register capi_nc driver\n");
return err;
@ -1302,7 +1302,7 @@ static int __init capinc_tty_init(void)
static void __exit capinc_tty_exit(void)
{
tty_unregister_driver(capinc_tty_driver);
put_tty_driver(capinc_tty_driver);
tty_driver_kref_put(capinc_tty_driver);
kfree(capiminors);
}

View File

@ -249,7 +249,7 @@ int bcm_vk_tty_init(struct bcm_vk *vk, char *name)
tty_drv->name = kstrdup(name, GFP_KERNEL);
if (!tty_drv->name) {
err = -ENOMEM;
goto err_put_tty_driver;
goto err_tty_driver_kref_put;
}
tty_drv->type = TTY_DRIVER_TYPE_SERIAL;
tty_drv->subtype = SERIAL_TYPE_NORMAL;
@ -295,8 +295,8 @@ int bcm_vk_tty_init(struct bcm_vk *vk, char *name)
kfree(tty_drv->name);
tty_drv->name = NULL;
err_put_tty_driver:
put_tty_driver(tty_drv);
err_tty_driver_kref_put:
tty_driver_kref_put(tty_drv);
return err;
}
@ -317,7 +317,7 @@ void bcm_vk_tty_exit(struct bcm_vk *vk)
kfree(vk->tty_drv->name);
vk->tty_drv->name = NULL;
put_tty_driver(vk->tty_drv);
tty_driver_kref_put(vk->tty_drv);
}
void bcm_vk_tty_terminate_tty_user(struct bcm_vk *vk)

View File

@ -1165,7 +1165,7 @@ static int __init sdio_uart_init(void)
err2:
tty_unregister_driver(tty_drv);
err1:
put_tty_driver(tty_drv);
tty_driver_kref_put(tty_drv);
return ret;
}
@ -1173,7 +1173,7 @@ static void __exit sdio_uart_exit(void)
{
sdio_unregister_driver(&sdio_uart_driver);
tty_unregister_driver(sdio_uart_tty_driver);
put_tty_driver(sdio_uart_tty_driver);
tty_driver_kref_put(sdio_uart_tty_driver);
}
module_init(sdio_uart_init);

View File

@ -3269,7 +3269,7 @@ static int __init hso_init(void)
err_unreg_tty:
tty_unregister_driver(tty_drv);
err_free_tty:
put_tty_driver(tty_drv);
tty_driver_kref_put(tty_drv);
return result;
}
@ -3280,7 +3280,7 @@ static void __exit hso_exit(void)
tty_unregister_driver(tty_drv);
/* deregister the usb driver */
usb_deregister(&hso_driver);
put_tty_driver(tty_drv);
tty_driver_kref_put(tty_drv);
}
/* Module definitions */

View File

@ -1082,7 +1082,7 @@ static int __init tty3215_init(void)
ret = ccw_driver_register(&raw3215_ccw_driver);
if (ret) {
put_tty_driver(driver);
tty_driver_kref_put(driver);
return ret;
}
/*
@ -1104,7 +1104,7 @@ static int __init tty3215_init(void)
tty_set_operations(driver, &tty3215_ops);
ret = tty_register_driver(driver);
if (ret) {
put_tty_driver(driver);
tty_driver_kref_put(driver);
return ret;
}
tty3215_driver = driver;

View File

@ -509,14 +509,14 @@ sclp_tty_init(void)
rc = sclp_rw_init();
if (rc) {
put_tty_driver(driver);
tty_driver_kref_put(driver);
return rc;
}
/* Allocate pages for output buffering */
for (i = 0; i < MAX_KMEM_PAGES; i++) {
page = (void *) get_zeroed_page(GFP_KERNEL | GFP_DMA);
if (page == NULL) {
put_tty_driver(driver);
tty_driver_kref_put(driver);
return -ENOMEM;
}
list_add_tail((struct list_head *) page, &sclp_tty_pages);
@ -532,7 +532,7 @@ sclp_tty_init(void)
rc = sclp_register(&sclp_input_event);
if (rc) {
put_tty_driver(driver);
tty_driver_kref_put(driver);
return rc;
}
@ -552,7 +552,7 @@ sclp_tty_init(void)
tty_port_link_device(&sclp_port, driver, 0);
rc = tty_register_driver(driver);
if (rc) {
put_tty_driver(driver);
tty_driver_kref_put(driver);
tty_port_destroy(&sclp_port);
return rc;
}

View File

@ -763,7 +763,7 @@ static int __init sclp_vt220_tty_init(void)
out_init:
__sclp_vt220_cleanup();
out_driver:
put_tty_driver(driver);
tty_driver_kref_put(driver);
return rc;
}
__initcall(sclp_vt220_tty_init);

View File

@ -1935,7 +1935,7 @@ static int __init tty3270_init(void)
tty_set_operations(driver, &tty3270_ops);
ret = tty_register_driver(driver);
if (ret) {
put_tty_driver(driver);
tty_driver_kref_put(driver);
return ret;
}
tty3270_driver = driver;
@ -1952,7 +1952,7 @@ tty3270_exit(void)
driver = tty3270_driver;
tty3270_driver = NULL;
tty_unregister_driver(driver);
put_tty_driver(driver);
tty_driver_kref_put(driver);
tty3270_del_views();
}

View File

@ -2852,11 +2852,11 @@ static int __init fwserial_init(void)
tty_unregister_driver(fwloop_driver);
put_loop:
if (create_loop_dev)
put_tty_driver(fwloop_driver);
tty_driver_kref_put(fwloop_driver);
unregister_driver:
tty_unregister_driver(fwtty_driver);
put_tty:
put_tty_driver(fwtty_driver);
tty_driver_kref_put(fwtty_driver);
remove_debugfs:
debugfs_remove_recursive(fwserial_debugfs);
@ -2871,10 +2871,10 @@ static void __exit fwserial_exit(void)
kmem_cache_destroy(fwtty_txn_cache);
if (create_loop_dev) {
tty_unregister_driver(fwloop_driver);
put_tty_driver(fwloop_driver);
tty_driver_kref_put(fwloop_driver);
}
tty_unregister_driver(fwtty_driver);
put_tty_driver(fwtty_driver);
tty_driver_kref_put(fwtty_driver);
debugfs_remove_recursive(fwserial_debugfs);
}

View File

@ -299,7 +299,7 @@ int register_lte_tty_driver(void)
ret = tty_register_driver(tty_driver);
if (ret) {
put_tty_driver(tty_driver);
tty_driver_kref_put(tty_driver);
return ret;
}
@ -318,7 +318,7 @@ void unregister_lte_tty_driver(void)
tty_driver = gdm_driver[i];
if (tty_driver) {
tty_unregister_driver(tty_driver);
put_tty_driver(tty_driver);
tty_driver_kref_put(tty_driver);
}
}
}

View File

@ -973,7 +973,7 @@ static int gb_tty_init(void)
return 0;
fail_put_gb_tty:
put_tty_driver(gb_tty_driver);
tty_driver_kref_put(gb_tty_driver);
fail_unregister_dev:
return retval;
}
@ -981,7 +981,7 @@ static int gb_tty_init(void)
static void gb_tty_exit(void)
{
tty_unregister_driver(gb_tty_driver);
put_tty_driver(gb_tty_driver);
tty_driver_kref_put(gb_tty_driver);
idr_destroy(&tty_minors);
}

View File

@ -1519,7 +1519,7 @@ static int __init amiga_serial_probe(struct platform_device *pdev)
error = tty_register_driver(driver);
if (error)
goto fail_put_tty_driver;
goto fail_tty_driver_kref_put;
printk(KERN_INFO "ttyS0 is the amiga builtin serial port\n");
@ -1566,9 +1566,9 @@ static int __init amiga_serial_probe(struct platform_device *pdev)
free_irq(IRQ_AMIGA_TBE, state);
fail_unregister:
tty_unregister_driver(driver);
fail_put_tty_driver:
fail_tty_driver_kref_put:
tty_port_destroy(&state->tport);
put_tty_driver(driver);
tty_driver_kref_put(driver);
return error;
}
@ -1577,7 +1577,7 @@ static int __exit amiga_serial_remove(struct platform_device *pdev)
struct serial_state *state = platform_get_drvdata(pdev);
tty_unregister_driver(serial_driver);
put_tty_driver(serial_driver);
tty_driver_kref_put(serial_driver);
tty_port_destroy(&state->tport);
free_irq(IRQ_AMIGA_TBE, state);

View File

@ -791,7 +791,7 @@ static int __init ehv_bc_init(void)
ret = tty_register_driver(driver);
if (ret) {
pr_err("ehv-bc: could not register tty driver (ret=%i)\n", ret);
goto err_put_tty_driver;
goto err_tty_driver_kref_put;
}
ehv_bc_driver = driver;
@ -808,8 +808,8 @@ static int __init ehv_bc_init(void)
err_deregister_tty_driver:
ehv_bc_driver = NULL;
tty_unregister_driver(driver);
err_put_tty_driver:
put_tty_driver(driver);
err_tty_driver_kref_put:
tty_driver_kref_put(driver);
err_free_bcs:
kfree(bcs);

View File

@ -274,7 +274,7 @@ static int goldfish_tty_create_driver(void)
return 0;
err_tty_register_driver_failed:
put_tty_driver(tty);
tty_driver_kref_put(tty);
err_tty_alloc_driver_failed:
kfree(goldfish_ttys);
goldfish_ttys = NULL;
@ -285,7 +285,7 @@ static int goldfish_tty_create_driver(void)
static void goldfish_tty_delete_driver(void)
{
tty_unregister_driver(goldfish_tty_driver);
put_tty_driver(goldfish_tty_driver);
tty_driver_kref_put(goldfish_tty_driver);
goldfish_tty_driver = NULL;
kfree(goldfish_ttys);
goldfish_ttys = NULL;

View File

@ -1063,7 +1063,7 @@ static int hvc_init(void)
kthread_stop(hvc_task);
hvc_task = NULL;
put_tty:
put_tty_driver(drv);
tty_driver_kref_put(drv);
out:
return err;
}

View File

@ -1509,7 +1509,7 @@ static int hvcs_initialize(void)
register_fail:
hvcs_free_index_list();
index_fail:
put_tty_driver(hvcs_tty_driver);
tty_driver_kref_put(hvcs_tty_driver);
hvcs_tty_driver = NULL;
mutex_unlock(&hvcs_init_mutex);
return rc;
@ -1562,7 +1562,7 @@ static void __exit hvcs_module_exit(void)
hvcs_free_index_list();
put_tty_driver(hvcs_tty_driver);
tty_driver_kref_put(hvcs_tty_driver);
printk(KERN_INFO "HVCS: driver module removed.\n");
}

View File

@ -585,7 +585,7 @@ int ipwireless_tty_init(void)
if (result) {
printk(KERN_ERR IPWIRELESS_PCCARD_NAME
": failed to register tty driver\n");
put_tty_driver(ipw_tty_driver);
tty_driver_kref_put(ipw_tty_driver);
return result;
}
@ -595,7 +595,7 @@ int ipwireless_tty_init(void)
void ipwireless_tty_release(void)
{
tty_unregister_driver(ipw_tty_driver);
put_tty_driver(ipw_tty_driver);
tty_driver_kref_put(ipw_tty_driver);
}
int ipwireless_tty_is_modem(struct ipw_tty *tty)

View File

@ -1042,7 +1042,7 @@ static int mips_ejtag_fdc_tty_probe(struct mips_cdmm_device *dev)
dport = &priv->ports[nport];
tty_port_destroy(&dport->port);
}
put_tty_driver(priv->driver);
tty_driver_kref_put(priv->driver);
return ret;
}

View File

@ -1053,7 +1053,7 @@ static int __init moxa_init(void)
if (tty_register_driver(moxaDriver)) {
printk(KERN_ERR "can't register MOXA Smartio tty driver!\n");
put_tty_driver(moxaDriver);
tty_driver_kref_put(moxaDriver);
return -1;
}
@ -1119,7 +1119,7 @@ static void __exit moxa_exit(void)
del_timer_sync(&moxaTimer);
tty_unregister_driver(moxaDriver);
put_tty_driver(moxaDriver);
tty_driver_kref_put(moxaDriver);
}
module_init(moxa_init);

View File

@ -2008,7 +2008,7 @@ static int __init mxser_module_init(void)
err_unr:
tty_unregister_driver(mxvar_sdriver);
err_put:
put_tty_driver(mxvar_sdriver);
tty_driver_kref_put(mxvar_sdriver);
return retval;
}
@ -2016,7 +2016,7 @@ static void __exit mxser_module_exit(void)
{
pci_unregister_driver(&mxser_driver);
tty_unregister_driver(mxvar_sdriver);
put_tty_driver(mxvar_sdriver);
tty_driver_kref_put(mxvar_sdriver);
}
module_init(mxser_module_init);

View File

@ -3279,7 +3279,7 @@ static int __init gsm_init(void)
gsm_tty_driver->major, gsm_tty_driver->minor_start);
return 0;
err_put_driver:
put_tty_driver(gsm_tty_driver);
tty_driver_kref_put(gsm_tty_driver);
err_unreg_ldisc:
tty_unregister_ldisc(&tty_ldisc_packet);
return status;
@ -3289,7 +3289,7 @@ static void __exit gsm_exit(void)
{
tty_unregister_ldisc(&tty_ldisc_packet);
tty_unregister_driver(gsm_tty_driver);
put_tty_driver(gsm_tty_driver);
tty_driver_kref_put(gsm_tty_driver);
}
module_init(gsm_init);

View File

@ -1857,7 +1857,7 @@ static __init int nozomi_init(void)
unr_tty:
tty_unregister_driver(ntty_driver);
free_tty:
put_tty_driver(ntty_driver);
tty_driver_kref_put(ntty_driver);
return ret;
}
@ -1865,7 +1865,7 @@ static __exit void nozomi_exit(void)
{
pci_unregister_driver(&nozomi_driver);
tty_unregister_driver(ntty_driver);
put_tty_driver(ntty_driver);
tty_driver_kref_put(ntty_driver);
}
module_init(nozomi_init);

View File

@ -355,7 +355,7 @@ int kgdb_register_nmi_console(void)
return 0;
err_drv_reg:
put_tty_driver(kgdb_nmi_tty_driver);
tty_driver_kref_put(kgdb_nmi_tty_driver);
return ret;
}
EXPORT_SYMBOL_GPL(kgdb_register_nmi_console);
@ -373,7 +373,7 @@ int kgdb_unregister_nmi_console(void)
return ret;
tty_unregister_driver(kgdb_nmi_tty_driver);
put_tty_driver(kgdb_nmi_tty_driver);
tty_driver_kref_put(kgdb_nmi_tty_driver);
return 0;
}

View File

@ -2568,7 +2568,7 @@ int uart_register_driver(struct uart_driver *drv)
for (i = 0; i < drv->nr; i++)
tty_port_destroy(&drv->state[i].port);
put_tty_driver(normal);
tty_driver_kref_put(normal);
out_kfree:
kfree(drv->state);
out:
@ -2590,7 +2590,7 @@ void uart_unregister_driver(struct uart_driver *drv)
unsigned int i;
tty_unregister_driver(p);
put_tty_driver(p);
tty_driver_kref_put(p);
for (i = 0; i < drv->nr; i++)
tty_port_destroy(&drv->state[i].port);
kfree(drv->state);

View File

@ -3650,7 +3650,7 @@ static void slgt_cleanup(void)
for (info=slgt_device_list ; info != NULL ; info=info->next_device)
tty_unregister_device(serial_driver, info->line);
tty_unregister_driver(serial_driver);
put_tty_driver(serial_driver);
tty_driver_kref_put(serial_driver);
}
/* reset devices */
@ -3712,7 +3712,7 @@ static int __init slgt_init(void)
tty_set_operations(serial_driver, &ops);
if ((rc = tty_register_driver(serial_driver)) < 0) {
DBGERR(("%s can't register serial driver\n", driver_name));
put_tty_driver(serial_driver);
tty_driver_kref_put(serial_driver);
serial_driver = NULL;
goto error;
}

View File

@ -3438,12 +3438,6 @@ void tty_driver_kref_put(struct tty_driver *driver)
}
EXPORT_SYMBOL(tty_driver_kref_put);
void put_tty_driver(struct tty_driver *d)
{
tty_driver_kref_put(d);
}
EXPORT_SYMBOL(put_tty_driver);
/*
* Called by a tty driver to register itself.
*/

View File

@ -84,7 +84,7 @@ static int __init ttynull_init(void)
ret = tty_register_driver(driver);
if (ret < 0) {
put_tty_driver(driver);
tty_driver_kref_put(driver);
tty_port_destroy(&ttynull_port);
return ret;
}
@ -99,7 +99,7 @@ static void __exit ttynull_exit(void)
{
unregister_console(&ttynull_console);
tty_unregister_driver(ttynull_driver);
put_tty_driver(ttynull_driver);
tty_driver_kref_put(ttynull_driver);
tty_port_destroy(&ttynull_port);
}

View File

@ -1028,7 +1028,7 @@ static int vcc_tty_init(void)
rv = tty_register_driver(vcc_tty_driver);
if (rv) {
pr_err("VCC: TTY driver registration failed\n");
put_tty_driver(vcc_tty_driver);
tty_driver_kref_put(vcc_tty_driver);
vcc_tty_driver = NULL;
return rv;
}
@ -1041,7 +1041,7 @@ static int vcc_tty_init(void)
static void vcc_tty_exit(void)
{
tty_unregister_driver(vcc_tty_driver);
put_tty_driver(vcc_tty_driver);
tty_driver_kref_put(vcc_tty_driver);
vccdbg("VCC: TTY driver unregistered\n");
vcc_tty_driver = NULL;

View File

@ -2044,14 +2044,14 @@ static int __init acm_init(void)
retval = tty_register_driver(acm_tty_driver);
if (retval) {
put_tty_driver(acm_tty_driver);
tty_driver_kref_put(acm_tty_driver);
return retval;
}
retval = usb_register(&acm_driver);
if (retval) {
tty_unregister_driver(acm_tty_driver);
put_tty_driver(acm_tty_driver);
tty_driver_kref_put(acm_tty_driver);
return retval;
}
@ -2064,7 +2064,7 @@ static void __exit acm_exit(void)
{
usb_deregister(&acm_driver);
tty_unregister_driver(acm_tty_driver);
put_tty_driver(acm_tty_driver);
tty_driver_kref_put(acm_tty_driver);
idr_destroy(&acm_minors);
}

View File

@ -1491,7 +1491,7 @@ static int userial_init(void)
return status;
fail:
put_tty_driver(driver);
tty_driver_kref_put(driver);
return status;
}
module_init(userial_init);
@ -1499,7 +1499,7 @@ module_init(userial_init);
static void userial_cleanup(void)
{
tty_unregister_driver(gs_tty_driver);
put_tty_driver(gs_tty_driver);
tty_driver_kref_put(gs_tty_driver);
gs_tty_driver = NULL;
}
module_exit(userial_cleanup);

View File

@ -541,7 +541,7 @@ static int dbc_tty_init(void)
ret = tty_register_driver(dbc_tty_driver);
if (ret) {
pr_err("Can't register dbc tty driver\n");
put_tty_driver(dbc_tty_driver);
tty_driver_kref_put(dbc_tty_driver);
}
return ret;
}
@ -550,7 +550,7 @@ static void dbc_tty_exit(void)
{
if (dbc_tty_driver) {
tty_unregister_driver(dbc_tty_driver);
put_tty_driver(dbc_tty_driver);
tty_driver_kref_put(dbc_tty_driver);
dbc_tty_driver = NULL;
}
}

View File

@ -1366,7 +1366,7 @@ static int __init usb_serial_init(void)
exit_bus:
pr_err("%s - returning with error %d\n", __func__, result);
put_tty_driver(usb_serial_tty_driver);
tty_driver_kref_put(usb_serial_tty_driver);
return result;
}
@ -1378,7 +1378,7 @@ static void __exit usb_serial_exit(void)
usb_serial_generic_deregister();
tty_unregister_driver(usb_serial_tty_driver);
put_tty_driver(usb_serial_tty_driver);
tty_driver_kref_put(usb_serial_tty_driver);
bus_unregister(&usb_serial_bus_type);
idr_destroy(&serial_minors);
}

View File

@ -329,7 +329,6 @@ extern struct list_head tty_drivers;
extern struct tty_driver *__tty_alloc_driver(unsigned int lines,
struct module *owner, unsigned long flags);
extern void put_tty_driver(struct tty_driver *driver);
extern struct tty_driver *tty_find_polling_driver(char *name, int *line);
extern void tty_driver_kref_put(struct tty_driver *driver);

View File

@ -1146,7 +1146,7 @@ int __init rfcomm_init_ttys(void)
error = tty_register_driver(rfcomm_tty_driver);
if (error) {
BT_ERR("Can't register RFCOMM TTY driver");
put_tty_driver(rfcomm_tty_driver);
tty_driver_kref_put(rfcomm_tty_driver);
return error;
}
@ -1158,5 +1158,5 @@ int __init rfcomm_init_ttys(void)
void rfcomm_cleanup_ttys(void)
{
tty_unregister_driver(rfcomm_tty_driver);
put_tty_driver(rfcomm_tty_driver);
tty_driver_kref_put(rfcomm_tty_driver);
}