Re: [PATCH] serial: vt8500: Fix clock reference leak in vt8500_serial_probe()
From: Alexey Charkov
Date: Fri Sep 18 2026 - 03:52:19 EST
On Thu, Sep 17, 2026 at 7:58 PM Wentao Liang <vulab@xxxxxxxxxxx> wrote:
>
> of_clk_get() returns a clock with a reference that has to be released
> with clk_put(). If clk_prepare_enable() fails the function returns
> without doing so, leaking the reference.
>
> Add the missing clk_put() on that error path.
>
> Fixes: 12faa35ae5cb ("serial: vt8500: UART uses gated clock rather than 24Mhz reference")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Wentao Liang <vulab@xxxxxxxxxxx>
> ---
> drivers/tty/serial/vt8500_serial.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/tty/serial/vt8500_serial.c b/drivers/tty/serial/vt8500_serial.c
> index 78a1c1eea11b..fc6fdc751b16 100644
> --- a/drivers/tty/serial/vt8500_serial.c
> +++ b/drivers/tty/serial/vt8500_serial.c
> @@ -656,6 +656,7 @@ static int vt8500_serial_probe(struct platform_device *pdev)
> ret = clk_prepare_enable(vt8500_port->clk);
> if (ret) {
> dev_err(&pdev->dev, "failed to enable clock\n");
> + clk_put(vt8500_port->clk);
The probe function currently mixes devm-managed and manual resource
allocations, with the clk standing out in particular. Instead of
adding a manual clk_put, could you please switch the clk calls to
devm_clk_get_enabled and drop redundant boilerplate?
Best regards,
Alexey