summaryrefslogtreecommitdiff
path: root/drivers/tty/serial
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2023-06-02 10:00:05 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-06-02 10:30:55 +0300
commit49c80922ff8115bc86c82e5fc9e6842cd87db689 (patch)
tree705214c97dde21c20195fbee6620a144d31a145a /drivers/tty/serial
parent539914240a01c7d68476d10c07b7f4f9a05d38ed (diff)
downloadlinux-49c80922ff8115bc86c82e5fc9e6842cd87db689.tar.xz
serial: core: Fix error handling for serial_core_ctrl_device_add()
Checking for NULL is incorrect as serial_base_ctrl_add() uses ERR_PTR(). Let's also pass any returned error along, there's no reason to translate all errors to -ENODEV. Fixes: 84a9582fd203 ("serial: core: Start managing serial controllers to enable runtime PM") Signed-off-by: Tony Lindgren <tony@atomide.com> Reviewed-by: Jiri Slaby <jirislaby@kernel.org> Link: https://lore.kernel.org/r/20230602070007.59268-1-tony@atomide.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial')
-rw-r--r--drivers/tty/serial/serial_core.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index efda90215ee9..831d033611e6 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -3342,8 +3342,8 @@ int serial_core_register_port(struct uart_driver *drv, struct uart_port *port)
ctrl_dev = serial_core_ctrl_find(drv, port->dev, port->ctrl_id);
if (!ctrl_dev) {
new_ctrl_dev = serial_core_ctrl_device_add(port);
- if (!new_ctrl_dev) {
- ret = -ENODEV;
+ if (IS_ERR(new_ctrl_dev)) {
+ ret = PTR_ERR(new_ctrl_dev);
goto err_unlock;
}
ctrl_dev = new_ctrl_dev;