Re: [PATCH v2 1/4] phy: freescale: fsl-samsung-hdmi: Fix runtime PM cleanup
From: Xu Yang
Date: Wed Jul 29 2026 - 05:37:57 EST
On Tue, Jul 21, 2026 at 02:47:49PM +0800, Can Peng wrote:
> fsl_samsung_hdmi_phy_probe() takes a runtime PM reference, marks the
> device active and enables runtime PM before registering the PHY clock.
> If phy_clk_register() fails, probe returns without dropping the runtime
> PM reference or disabling runtime PM.
>
> The remove callback only unregisters the clock provider, so runtime PM
> is also left enabled after a successful probe followed by driver unbind.
>
> Check pm_runtime_set_active(), use devm_pm_runtime_enable() so runtime
> PM is disabled automatically, and drop the initial noresume reference
> on PM setup and clock registration failures.
>
> Fixes: 6ad082bee902 ("phy: freescale: add Samsung HDMI PHY")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Can Peng <pengcan@xxxxxxxxxx>
> ---
> drivers/phy/freescale/phy-fsl-samsung-hdmi.c | 14 ++++++++++----
> 1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/phy/freescale/phy-fsl-samsung-hdmi.c b/drivers/phy/freescale/phy-fsl-samsung-hdmi.c
> index d010fec15671..e7af4f9c7b20 100644
> --- a/drivers/phy/freescale/phy-fsl-samsung-hdmi.c
> +++ b/drivers/phy/freescale/phy-fsl-samsung-hdmi.c
> @@ -665,20 +665,26 @@ static int fsl_samsung_hdmi_phy_probe(struct platform_device *pdev)
> "failed to get ref clk\n");
>
> pm_runtime_get_noresume(phy->dev);
> - pm_runtime_set_active(phy->dev);
> - pm_runtime_enable(phy->dev);
> + ret = pm_runtime_set_active(phy->dev);
> + if (ret)
> + goto pm_put_noidle;
> +
> + ret = devm_pm_runtime_enable(phy->dev);
> + if (ret)
> + goto pm_put_noidle;
>
> ret = phy_clk_register(phy);
> if (ret) {
> dev_err(&pdev->dev, "register clk failed\n");
> - goto register_clk_failed;
> + goto pm_put_noidle;
> }
>
> pm_runtime_put(phy->dev);
>
> return 0;
>
> -register_clk_failed:
> +pm_put_noidle:
> + pm_runtime_put_noidle(phy->dev);
> return ret;
> }
If the probe() fails, clk "apb" will be disabled twice:
devm_clk_get_enabled(phy->dev, "apb");
devm_pm_runtime_enable(phy->dev);
...
1. undo devm_pm_ ...
pm_runtime_disable_action();
pm_runtime_dont_use_autosuspend();
...
fsl_samsung_hdmi_phy_suspend()
clk_disable_unprepare()
2. undo devm_clk_ ...
clk_disable_unprepare()
>
> --
> 2.53.0
>