[PATCH v2] phy: phy-mtk-tphy: Fix some resource leaks in mtk_phy_init()

Subsystems: arm/mediatek usb3 phy driver, generic phy framework, the rest

STALE1931d LANDED: 2 (2M)

1 review trailer (1 from subsystem maintainers); landed in mainline as aaac9a1bd370 on 2021-05-31.

2 messages, 2 authors, 2021-05-31 · open the first message on its own page

[PATCH v2] phy: phy-mtk-tphy: Fix some resource leaks in mtk_phy_init()

From: Tiezhu Yang <yangtiezhu@loongson.cn>
Date: 2021-05-19 10:39:14

Use clk_disable_unprepare() in the error path of mtk_phy_init() to fix
some resource leaks.

Reported-by: kernel test robot <redacted>
Reported-by: Dan Carpenter <redacted>
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Reviewed-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---

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


_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

Re: [PATCH v2] phy: phy-mtk-tphy: Fix some resource leaks in mtk_phy_init()

From: Vinod Koul <vkoul@kernel.org>
Date: 2021-05-31 08:28:59

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

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help