Commit 49c80922 authored by Tony Lindgren's avatar Tony Lindgren Committed by Greg Kroah-Hartman

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: 84a9582f ("serial: core: Start managing serial controllers to enable runtime PM")
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
Reviewed-by: default avatarJiri Slaby <jirislaby@kernel.org>
Link: https://lore.kernel.org/r/20230602070007.59268-1-tony@atomide.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 53991424
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment