]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
phy: freescale: phy-fsl-imx8qm-lvds-phy: Fix missing pm_runtime_disable() on probe...
authorFelix Gu <ustc.gu@gmail.com>
Fri, 5 Jun 2026 11:57:20 +0000 (19:57 +0800)
committerVinod Koul <vkoul@kernel.org>
Thu, 11 Jun 2026 15:27:07 +0000 (20:57 +0530)
If mixel_lvds_phy_reset() fails in probe after pm_runtime_enable(),
the function returns directly without calling pm_runtime_disable(),
leaving runtime PM permanently enabled for the device.

Fix this by using devm_pm_runtime_enable() so that cleanup is
automatic on any probe failure or driver unbind. This also allows
removing the manual err label and the .remove callback.

Fixes: 06ff622d61d2 ("phy: freescale: Add i.MX8qm Mixel LVDS PHY support")
Acked-by: Liu Ying <victor.liu@nxp.com>
Signed-off-by: Felix Gu <ustc.gu@gmail.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20260605-lvds-v2-1-3ce7539d1104@gmail.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/phy/freescale/phy-fsl-imx8qm-lvds-phy.c

index e2a1645000ae55f87b40980db46552f12a71d96a..368679436d86270e37001ace398bc3ead11492d8 100644 (file)
@@ -345,7 +345,9 @@ static int mixel_lvds_phy_probe(struct platform_device *pdev)
 
        dev_set_drvdata(dev, priv);
 
-       pm_runtime_enable(dev);
+       ret = devm_pm_runtime_enable(dev);
+       if (ret)
+               return ret;
 
        ret = mixel_lvds_phy_reset(dev);
        if (ret) {
@@ -355,17 +357,15 @@ static int mixel_lvds_phy_probe(struct platform_device *pdev)
 
        for (i = 0; i < PHY_NUM; i++) {
                lvds_phy = devm_kzalloc(dev, sizeof(*lvds_phy), GFP_KERNEL);
-               if (!lvds_phy) {
-                       ret = -ENOMEM;
-                       goto err;
-               }
+               if (!lvds_phy)
+                       return -ENOMEM;
 
                phy = devm_phy_create(dev, NULL, &mixel_lvds_phy_ops);
                if (IS_ERR(phy)) {
                        ret = PTR_ERR(phy);
                        dev_err(dev, "failed to create PHY for channel%d: %d\n",
                                i, ret);
-                       goto err;
+                       return ret;
                }
 
                lvds_phy->phy = phy;
@@ -379,19 +379,10 @@ static int mixel_lvds_phy_probe(struct platform_device *pdev)
        if (IS_ERR(phy_provider)) {
                ret = PTR_ERR(phy_provider);
                dev_err(dev, "failed to register PHY provider: %d\n", ret);
-               goto err;
+               return ret;
        }
 
        return 0;
-err:
-       pm_runtime_disable(dev);
-
-       return ret;
-}
-
-static void mixel_lvds_phy_remove(struct platform_device *pdev)
-{
-       pm_runtime_disable(&pdev->dev);
 }
 
 static int __maybe_unused mixel_lvds_phy_runtime_suspend(struct device *dev)
@@ -432,7 +423,6 @@ MODULE_DEVICE_TABLE(of, mixel_lvds_phy_of_match);
 
 static struct platform_driver mixel_lvds_phy_driver = {
        .probe = mixel_lvds_phy_probe,
-       .remove = mixel_lvds_phy_remove,
        .driver = {
                .pm = &mixel_lvds_phy_pm_ops,
                .name = "mixel-lvds-phy",