[PATCH 3/3] xhci: dbgtty: Drop extra call to idr_destroy()
From: Lucas De Marchi
Date: Mon Jul 20 2026 - 16:32:21 EST
idr_destroy() is already called on error paths in dbc_tty_init(). Do not
call it again on exit. For symmetry with the init side, also use
IS_ERR_OR_NULL() to gate the exit steps.
Signed-off-by: Lucas De Marchi <ldemarchi@xxxxxxxxxx>
---
drivers/usb/host/xhci-dbgtty.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/usb/host/xhci-dbgtty.c b/drivers/usb/host/xhci-dbgtty.c
index 7e44e62d6ea9..3d51e8d82659 100644
--- a/drivers/usb/host/xhci-dbgtty.c
+++ b/drivers/usb/host/xhci-dbgtty.c
@@ -665,11 +665,11 @@ int dbc_tty_init(void)
void dbc_tty_exit(void)
{
- if (dbc_tty_driver) {
- tty_unregister_driver(dbc_tty_driver);
- tty_driver_kref_put(dbc_tty_driver);
- dbc_tty_driver = NULL;
- }
+ if (IS_ERR_OR_NULL(dbc_tty_driver))
+ return;
+ tty_unregister_driver(dbc_tty_driver);
+ tty_driver_kref_put(dbc_tty_driver);
idr_destroy(&dbc_tty_minors);
+ dbc_tty_driver = NULL;
}
--
2.54.0