summaryrefslogtreecommitdiffstats
path: root/drivers/tty/serial
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2023-08-04 12:09:07 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-08-04 15:11:36 +0200
commit6be1a8d50b381ca022a79e47f2dc0d3aa698af14 (patch)
tree0b6f06e3f5198b580c7fb7344306c29077e3890c /drivers/tty/serial
parent238500e2d67c0463ec83a43a083dc25db6520acd (diff)
downloadlinux-stable-6be1a8d50b381ca022a79e47f2dc0d3aa698af14.tar.gz
linux-stable-6be1a8d50b381ca022a79e47f2dc0d3aa698af14.tar.bz2
linux-stable-6be1a8d50b381ca022a79e47f2dc0d3aa698af14.zip
serial: core: Fix kmemleak issue for serial core device remove
Kmemleak reports issues for serial8250 ports after the hardware specific driver takes over on boot as noted by Tomi. The kerneldoc for device_initialize() says we must call device_put() after calling device_initialize(). We are calling device_put() on the error path, but are missing it from the device remove path. This causes release() to never get called for the devices on remove. Let's add the missing put_device() calls for both serial ctrl and port devices. Fixes: 84a9582fd203 ("serial: core: Start managing serial controllers to enable runtime PM") Reported-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Signed-off-by: Tony Lindgren <tony@atomide.com> Tested-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Link: https://lore.kernel.org/r/20230804090909.51529-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_base_bus.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/tty/serial/serial_base_bus.c b/drivers/tty/serial/serial_base_bus.c
index 0892369f98d2..e95c68825d2f 100644
--- a/drivers/tty/serial/serial_base_bus.c
+++ b/drivers/tty/serial/serial_base_bus.c
@@ -99,6 +99,7 @@ void serial_base_ctrl_device_remove(struct serial_ctrl_device *ctrl_dev)
return;
device_del(&ctrl_dev->dev);
+ put_device(&ctrl_dev->dev);
}
struct serial_ctrl_device *serial_base_ctrl_add(struct uart_port *port,
@@ -174,6 +175,7 @@ void serial_base_port_device_remove(struct serial_port_device *port_dev)
return;
device_del(&port_dev->dev);
+ put_device(&port_dev->dev);
}
static int serial_base_init(void)