[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210302062214.29627-34-jslaby@suse.cz>
Date: Tue, 2 Mar 2021 07:22:04 +0100
From: Jiri Slaby <jslaby@...e.cz>
To: gregkh@...uxfoundation.org
Cc: linux-serial@...r.kernel.org, linux-kernel@...r.kernel.org,
Jiri Slaby <jslaby@...e.cz>, Chris Zankel <chris@...kel.net>,
Max Filippov <jcmvbkbc@...il.com>,
linux-xtensa@...ux-xtensa.org, Jiri Kosina <jikos@...nel.org>,
David Sterba <dsterba@...e.com>
Subject: [PATCH 34/44] 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.
Signed-off-by: Jiri Slaby <jslaby@...e.cz>
Cc: Chris Zankel <chris@...kel.net>
Cc: Max Filippov <jcmvbkbc@...il.com>
Cc: linux-xtensa@...ux-xtensa.org
Cc: Jiri Kosina <jikos@...nel.org>
Cc: David Sterba <dsterba@...e.com>
---
arch/xtensa/platforms/iss/console.c | 6 +-----
drivers/tty/amiserial.c | 8 ++------
drivers/tty/ipwireless/tty.c | 7 +------
drivers/tty/moxa.c | 4 +---
drivers/tty/serial/kgdb_nmi.c | 4 +---
drivers/tty/synclink_gt.c | 5 +----
6 files changed, 7 insertions(+), 27 deletions(-)
diff --git a/arch/xtensa/platforms/iss/console.c b/arch/xtensa/platforms/iss/console.c
index 1e215cf5ad03..a3dda25a4e45 100644
--- a/arch/xtensa/platforms/iss/console.c
+++ b/arch/xtensa/platforms/iss/console.c
@@ -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);
}
diff --git a/drivers/tty/amiserial.c b/drivers/tty/amiserial.c
index 18b78ea110ef..0c8157fab17f 100644
--- a/drivers/tty/amiserial.c
+++ b/drivers/tty/amiserial.c
@@ -1622,21 +1622,17 @@ static int __init amiga_serial_probe(struct platform_device *pdev)
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 = {
diff --git a/drivers/tty/ipwireless/tty.c b/drivers/tty/ipwireless/tty.c
index 6dacbc5e286c..1836746991b5 100644
--- a/drivers/tty/ipwireless/tty.c
+++ b/drivers/tty/ipwireless/tty.c
@@ -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)
diff --git a/drivers/tty/moxa.c b/drivers/tty/moxa.c
index 9f13f7d49dd7..32eb6b5e510f 100644
--- a/drivers/tty/moxa.c
+++ b/drivers/tty/moxa.c
@@ -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);
}
diff --git a/drivers/tty/serial/kgdb_nmi.c b/drivers/tty/serial/kgdb_nmi.c
index 6004c0c1d173..db059b66438e 100644
--- a/drivers/tty/serial/kgdb_nmi.c
+++ b/drivers/tty/serial/kgdb_nmi.c
@@ -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;
diff --git a/drivers/tty/synclink_gt.c b/drivers/tty/synclink_gt.c
index 644173786bf0..4727a41158b0 100644
--- a/drivers/tty/synclink_gt.c
+++ b/drivers/tty/synclink_gt.c
@@ -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);
}
--
2.30.1
Powered by blists - more mailing lists