Re: [PATCH] serial: 8250_uniphier: Disable clock on probe error path

From: Andy Shevchenko

Date: Wed Sep 16 2026 - 07:44:44 EST


On Wed, Sep 16, 2026 at 09:54:36AM +0000, Malathi A wrote:
> uniphier_uart_probe() calls clk_prepare_enable() on priv->clk before it
> reads the port properties, but returns directly when
> uart_read_port_properties() fails, leaving the clock prepared and
> enabled.
>
> The intent is clear from the surrounding code: the next error path, when
> serial8250_register_8250_port() fails, calls clk_disable_unprepare(), as
> does uniphier_uart_remove(). Add the missing call so the early failure
> behaves the same way.
>
> Found by smatch:
>
> drivers/tty/serial/8250/8250_uniphier.c:232 uniphier_uart_probe() warn: 'priv->clk' from clk_prepare_enable() not released on lines: 205.

Why not using devm_clk_get_enabled() instead?

--
With Best Regards,
Andy Shevchenko