[PATCH 3/4] serial: vt8500: Handle uart_add_one_port() failure
From: Alexey Charkov
Date: Wed Nov 11 2026 - 14:26:39 EST
Return the error from uart_add_one_port() instead of reporting a bound
device for a port that never registered, which would keep its clock
running for nothing. Let devres release the clock and the remaining
resources on that path.
Set the driver data before adding the port, so that the probe can end
on the registration call.
Fixes: 304e12665a4a ("serial: Add support for UART on VIA VT8500 and compatibles")
Reported-by: Sashiko <sashiko-bot@xxxxxxxxxx>
Closes: https://sashiko.dev/#/bug/linux-ce64cdae-9faa-4109-b7da-29b8a8c99e76
Signed-off-by: Alexey Charkov <alchark@xxxxxxxxx>
---
drivers/tty/serial/vt8500_serial.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/tty/serial/vt8500_serial.c b/drivers/tty/serial/vt8500_serial.c
index 17f928a7073a..7c7b4beb51fd 100644
--- a/drivers/tty/serial/vt8500_serial.c
+++ b/drivers/tty/serial/vt8500_serial.c
@@ -671,11 +671,9 @@ static int vt8500_serial_probe(struct platform_device *pdev)
snprintf(vt8500_port->name, sizeof(vt8500_port->name),
"VT8500 UART%d", pdev->id);
- uart_add_one_port(&vt8500_uart_driver, &vt8500_port->uart);
-
platform_set_drvdata(pdev, vt8500_port);
- return 0;
+ return uart_add_one_port(&vt8500_uart_driver, &vt8500_port->uart);
}
static struct platform_driver vt8500_platform_driver = {
--
2.56.0