tty: do not check tty_unregister_driver's return value
These drivers check tty_unregister_driver return value. But they don't handle a failure correctly (they free the driver in any case). So stop checking tty_unregister_driver return value and remove also the prints. In the next patch, tty_unregister_driver's return type will be switched to void. Cc: Chris Zankel <chris@zankel.net> Cc: Max Filippov <jcmvbkbc@gmail.com> Cc: linux-xtensa@linux-xtensa.org Cc: Jiri Kosina <jikos@kernel.org> Cc: David Sterba <dsterba@suse.com> Reviewed-by: Max Filippov <jcmvbkbc@gmail.com> Acked-by: David Sterba <dsterba@suse.com> Signed-off-by: Jiri Slaby <jslaby@suse.cz> Link: https://lore.kernel.org/r/20210302062214.29627-34-jslaby@suse.cz Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
ba444ea3bc
commit
6c2e6317c9
|
@ -171,11 +171,7 @@ static int __init rs_init(void)
|
|||
|
||||
static __exit void rs_exit(void)
|
||||
{
|
||||
int error;
|
||||
|
||||
if ((error = tty_unregister_driver(serial_driver)))
|
||||
pr_err("ISS_SERIAL: failed to unregister serial driver (%d)\n",
|
||||
error);
|
||||
tty_unregister_driver(serial_driver);
|
||||
put_tty_driver(serial_driver);
|
||||
tty_port_destroy(&serial_port);
|
||||
}
|
||||
|
|
|
@ -1622,21 +1622,17 @@ fail_put_tty_driver:
|
|||
|
||||
static int __exit amiga_serial_remove(struct platform_device *pdev)
|
||||
{
|
||||
int error;
|
||||
struct serial_state *state = platform_get_drvdata(pdev);
|
||||
|
||||
/* printk("Unloading %s: version %s\n", serial_name, serial_version); */
|
||||
error = tty_unregister_driver(serial_driver);
|
||||
if (error)
|
||||
printk("SERIAL: failed to unregister serial driver (%d)\n",
|
||||
error);
|
||||
tty_unregister_driver(serial_driver);
|
||||
put_tty_driver(serial_driver);
|
||||
tty_port_destroy(&state->tport);
|
||||
|
||||
free_irq(IRQ_AMIGA_TBE, state);
|
||||
free_irq(IRQ_AMIGA_RBF, state);
|
||||
|
||||
return error;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct platform_driver amiga_serial_driver = {
|
||||
|
|
|
@ -596,13 +596,8 @@ int ipwireless_tty_init(void)
|
|||
|
||||
void ipwireless_tty_release(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = tty_unregister_driver(ipw_tty_driver);
|
||||
tty_unregister_driver(ipw_tty_driver);
|
||||
put_tty_driver(ipw_tty_driver);
|
||||
if (ret != 0)
|
||||
printk(KERN_ERR IPWIRELESS_PCCARD_NAME
|
||||
": tty_unregister_driver failed with code %d\n", ret);
|
||||
}
|
||||
|
||||
int ipwireless_tty_is_modem(struct ipw_tty *tty)
|
||||
|
|
|
@ -1118,9 +1118,7 @@ static void __exit moxa_exit(void)
|
|||
|
||||
del_timer_sync(&moxaTimer);
|
||||
|
||||
if (tty_unregister_driver(moxaDriver))
|
||||
printk(KERN_ERR "Couldn't unregister MOXA Intellio family "
|
||||
"serial driver\n");
|
||||
tty_unregister_driver(moxaDriver);
|
||||
put_tty_driver(moxaDriver);
|
||||
}
|
||||
|
||||
|
|
|
@ -373,9 +373,7 @@ int kgdb_unregister_nmi_console(void)
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = tty_unregister_driver(kgdb_nmi_tty_driver);
|
||||
if (ret)
|
||||
return ret;
|
||||
tty_unregister_driver(kgdb_nmi_tty_driver);
|
||||
put_tty_driver(kgdb_nmi_tty_driver);
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -3705,7 +3705,6 @@ static const struct tty_operations ops = {
|
|||
|
||||
static void slgt_cleanup(void)
|
||||
{
|
||||
int rc;
|
||||
struct slgt_info *info;
|
||||
struct slgt_info *tmp;
|
||||
|
||||
|
@ -3714,9 +3713,7 @@ static void slgt_cleanup(void)
|
|||
if (serial_driver) {
|
||||
for (info=slgt_device_list ; info != NULL ; info=info->next_device)
|
||||
tty_unregister_device(serial_driver, info->line);
|
||||
rc = tty_unregister_driver(serial_driver);
|
||||
if (rc)
|
||||
DBGERR(("tty_unregister_driver error=%d\n", rc));
|
||||
tty_unregister_driver(serial_driver);
|
||||
put_tty_driver(serial_driver);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue