Use clk_disable_unprepare() in the error path of mtk_phy_init() to fix
some resource leaks.
Reported-by: kernel test robot <[email protected]>
Reported-by: Dan Carpenter <[email protected]>
Signed-off-by: Tiezhu Yang <[email protected]>
Reviewed-by: Chunfeng Yun <[email protected]>
---
v2: remove Fixes tag and add Reviewed-by tag
drivers/phy/mediatek/phy-mtk-tphy.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/phy/mediatek/phy-mtk-tphy.c b/drivers/phy/mediatek/phy-mtk-tphy.c
index cdbcc49..731c483 100644
--- a/drivers/phy/mediatek/phy-mtk-tphy.c
+++ b/drivers/phy/mediatek/phy-mtk-tphy.c
@@ -949,6 +949,8 @@ static int mtk_phy_init(struct phy *phy)
break;
default:
dev_err(tphy->dev, "incompatible PHY type\n");
+ clk_disable_unprepare(instance->ref_clk);
+ clk_disable_unprepare(instance->da_ref_clk);
return -EINVAL;
}
--
2.1.0
On 19-05-21, 18:37, Tiezhu Yang wrote:
> Use clk_disable_unprepare() in the error path of mtk_phy_init() to fix
> some resource leaks.
Applied, thanks
--
~Vinod