diff options
author | Tvrtko Ursulin <tvrtko.ursulin@intel.com> | 2022-01-18 11:54:02 +0100 |
---|---|---|
committer | Tvrtko Ursulin <tvrtko.ursulin@intel.com> | 2022-01-18 11:54:02 +0100 |
commit | 647bfd26bf054313305ea9c2c4a1c71f3bbfee63 (patch) | |
tree | 49abfde459ef32c9811d06ae59dfbaf0000762ab /drivers/tty/serial/liteuart.c | |
parent | i915: make array flex_regs static const (diff) | |
parent | Merge tag 'amd-drm-next-5.17-2022-01-12' of https://gitlab.freedesktop.org/ag... (diff) | |
download | linux-647bfd26bf054313305ea9c2c4a1c71f3bbfee63.tar.xz linux-647bfd26bf054313305ea9c2c4a1c71f3bbfee63.zip |
Merge drm/drm-next into drm-intel-gt-next
Maarten needs backmerge to account for header file renames/changes which
landed via drm-intel-next and are interfering with his pinning work.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Diffstat (limited to 'drivers/tty/serial/liteuart.c')
-rw-r--r-- | drivers/tty/serial/liteuart.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/drivers/tty/serial/liteuart.c b/drivers/tty/serial/liteuart.c index dbc0559a9157..2941659e5274 100644 --- a/drivers/tty/serial/liteuart.c +++ b/drivers/tty/serial/liteuart.c @@ -270,8 +270,10 @@ static int liteuart_probe(struct platform_device *pdev) /* get membase */ port->membase = devm_platform_get_and_ioremap_resource(pdev, 0, NULL); - if (IS_ERR(port->membase)) - return PTR_ERR(port->membase); + if (IS_ERR(port->membase)) { + ret = PTR_ERR(port->membase); + goto err_erase_id; + } /* values not from device tree */ port->dev = &pdev->dev; @@ -285,7 +287,18 @@ static int liteuart_probe(struct platform_device *pdev) port->line = dev_id; spin_lock_init(&port->lock); - return uart_add_one_port(&liteuart_driver, &uart->port); + platform_set_drvdata(pdev, port); + + ret = uart_add_one_port(&liteuart_driver, &uart->port); + if (ret) + goto err_erase_id; + + return 0; + +err_erase_id: + xa_erase(&liteuart_array, uart->id); + + return ret; } static int liteuart_remove(struct platform_device *pdev) @@ -293,6 +306,7 @@ static int liteuart_remove(struct platform_device *pdev) struct uart_port *port = platform_get_drvdata(pdev); struct liteuart_port *uart = to_liteuart_port(port); + uart_remove_one_port(&liteuart_driver, port); xa_erase(&liteuart_array, uart->id); return 0; |