aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/serial/8250.c30
1 files changed, 20 insertions, 10 deletions
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index fb610c3634a4..d9ce8c549416 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -2454,6 +2454,7 @@ static struct platform_driver serial8250_isa_driver = {
2454 .resume = serial8250_resume, 2454 .resume = serial8250_resume,
2455 .driver = { 2455 .driver = {
2456 .name = "serial8250", 2456 .name = "serial8250",
2457 .owner = THIS_MODULE,
2457 }, 2458 },
2458}; 2459};
2459 2460
@@ -2594,21 +2595,30 @@ static int __init serial8250_init(void)
2594 if (ret) 2595 if (ret)
2595 goto out; 2596 goto out;
2596 2597
2597 serial8250_isa_devs = platform_device_register_simple("serial8250", 2598 ret = platform_driver_register(&serial8250_isa_driver);
2598 PLAT8250_DEV_LEGACY, NULL, 0); 2599 if (ret)
2599 if (IS_ERR(serial8250_isa_devs)) { 2600 goto unreg_uart_drv;
2600 ret = PTR_ERR(serial8250_isa_devs); 2601
2601 goto unreg; 2602 serial8250_isa_devs = platform_device_alloc("serial8250",
2603 PLAT8250_DEV_LEGACY);
2604 if (!serial8250_isa_devs) {
2605 ret = -ENOMEM;
2606 goto unreg_plat_drv;
2602 } 2607 }
2603 2608
2609 ret = platform_device_add(serial8250_isa_devs);
2610 if (ret)
2611 goto put_dev;
2612
2604 serial8250_register_ports(&serial8250_reg, &serial8250_isa_devs->dev); 2613 serial8250_register_ports(&serial8250_reg, &serial8250_isa_devs->dev);
2605 2614
2606 ret = platform_driver_register(&serial8250_isa_driver); 2615 goto out;
2607 if (ret == 0)
2608 goto out;
2609 2616
2610 platform_device_unregister(serial8250_isa_devs); 2617 put_dev:
2611 unreg: 2618 platform_device_put(serial8250_isa_devs);
2619 unreg_plat_drv:
2620 platform_driver_unregister(&serial8250_isa_driver);
2621 unreg_uart_drv:
2612 uart_unregister_driver(&serial8250_reg); 2622 uart_unregister_driver(&serial8250_reg);
2613 out: 2623 out:
2614 return ret; 2624 return ret;