[PATCH] phy: rockchip: Fix resource leakage in inno_dsidphy_power_on

GUO Zihua guozihua at huawei.com
Sat Nov 19 23:13:30 PST 2022


inno->pclk_phy and inno->ref_clk is not unprepared in error path.
pm_runtime should also be put. This patch fix these issues.

This resolves smatch warning:
inno_dsidphy_power_on() warn: 'inno->pclk_phy' from clk_prepare_enable()
	not released on lines: 607.

Fixes: b7535a3bc0ba ("phy/rockchip: Add support for Innosilicon MIPI/LVDS/TTL PHY")
Fixes: f0684c1a8367 ("phy/rockchip: inno-dsidphy: generalize parameter handling")
Signed-off-by: GUO Zihua <guozihua at huawei.com>
---
 drivers/phy/rockchip/phy-rockchip-inno-dsidphy.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/phy/rockchip/phy-rockchip-inno-dsidphy.c b/drivers/phy/rockchip/phy-rockchip-inno-dsidphy.c
index 2c5847faff63..20ba716f5dd0 100644
--- a/drivers/phy/rockchip/phy-rockchip-inno-dsidphy.c
+++ b/drivers/phy/rockchip/phy-rockchip-inno-dsidphy.c
@@ -604,6 +604,9 @@ static int inno_dsidphy_power_on(struct phy *phy)
 		inno_dsidphy_lvds_mode_enable(inno);
 		break;
 	default:
+		pm_runtime_put_sync(inno->dev);
+		clk_disable_unprepare(inno->ref_clk);
+		clk_disable_unprepare(inno->pclk_phy);
 		return -EINVAL;
 	}
 
-- 
2.17.1




More information about the Linux-rockchip mailing list