diff --git a/drivers/tty/serial/8250/8250.h b/drivers/tty/serial/8250/8250.h index 54b4d5a5e36e..4dfe8c65a3d8 100644 --- a/drivers/tty/serial/8250/8250.h +++ b/drivers/tty/serial/8250/8250.h @@ -324,8 +324,10 @@ static inline void serial8250_pnp_exit(void) { } #ifdef CONFIG_SERIAL_8250_HUB6 int serial8250_hub6_init(void); +void serial8250_hub6_exit(void); #else static inline int serial8250_hub6_init(void) { return 0; } +static inline void serial8250_hub6_exit(void) { } #endif #ifdef CONFIG_SERIAL_8250_RSA diff --git a/drivers/tty/serial/8250/8250_hub6.c b/drivers/tty/serial/8250/8250_hub6.c index 3e548530ec4e..4d4c54c951cb 100644 --- a/drivers/tty/serial/8250/8250_hub6.c +++ b/drivers/tty/serial/8250/8250_hub6.c @@ -53,3 +53,8 @@ int __init serial8250_hub6_init(void) { return platform_device_register(&hub6_device); } + +void __init_or_module serial8250_hub6_exit(void) +{ + platform_device_unregister(&hub6_device); +} diff --git a/drivers/tty/serial/8250/8250_platform.c b/drivers/tty/serial/8250/8250_platform.c index 3a2dff9ce7b7..0570366a71d0 100644 --- a/drivers/tty/serial/8250/8250_platform.c +++ b/drivers/tty/serial/8250/8250_platform.c @@ -326,7 +326,7 @@ static int __init serial8250_init(void) serial8250_isa_devs = platform_device_alloc("serial8250", PLAT8250_DEV_LEGACY); if (!serial8250_isa_devs) { ret = -ENOMEM; - goto unreg_pnp; + goto unreg_hub6; } ret = platform_device_add(serial8250_isa_devs); @@ -342,6 +342,8 @@ static int __init serial8250_init(void) platform_device_del(serial8250_isa_devs); put_dev: platform_device_put(serial8250_isa_devs); +unreg_hub6: + serial8250_hub6_exit(); unreg_pnp: serial8250_pnp_exit(); unreg_uart_drv: @@ -369,6 +371,7 @@ static void __exit serial8250_exit(void) platform_driver_unregister(&serial8250_isa_driver); platform_device_unregister(isa_dev); + serial8250_hub6_exit(); serial8250_pnp_exit(); #ifdef CONFIG_SPARC