lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20240822084433.1596209-1-frank.li@vivo.com>
Date: Thu, 22 Aug 2024 02:44:33 -0600
From: Yangtao Li <frank.li@...o.com>
To: vkoul@...nel.org,
	kishon@...nel.org,
	krzk@...nel.org,
	alim.akhtar@...sung.com,
	frank.li@...o.com,
	konrad.dybcio@...aro.org,
	liubo03@...pur.com,
	robh@...nel.org,
	yuvaraj.cd@...il.com,
	ks.giri@...sung.com,
	vasanth.a@...sung.com
Cc: linux-arm-msm@...r.kernel.org,
	linux-phy@...ts.infradead.org,
	linux-kernel@...r.kernel.org,
	linux-arm-kernel@...ts.infradead.org,
	linux-samsung-soc@...r.kernel.org
Subject: [PATCH 4/4] phy: samsung: exynos5250-sata: fix missing clock disable in remove path

Convert devm_clk_get(), clk_prepare_enable() to a single
call to devm_clk_get_enabled(), as this is exactly
what this function does.

The devm_clk_get_enabled() helpers avoids the calls to
clk_disable_unprepare().

Fixes: bcff4cba41bc ("PHY: Exynos: Add Exynos5250 SATA PHY driver")
Signed-off-by: Yangtao Li <frank.li@...o.com>
---
 drivers/phy/samsung/phy-exynos5250-sata.c | 20 ++++++--------------
 1 file changed, 6 insertions(+), 14 deletions(-)

diff --git a/drivers/phy/samsung/phy-exynos5250-sata.c b/drivers/phy/samsung/phy-exynos5250-sata.c
index 595adba5fb8f..0452b236ea50 100644
--- a/drivers/phy/samsung/phy-exynos5250-sata.c
+++ b/drivers/phy/samsung/phy-exynos5250-sata.c
@@ -47,7 +47,6 @@
 
 struct exynos_sata_phy {
 	struct phy *phy;
-	struct clk *phyclk;
 	void __iomem *regs;
 	struct regmap *pmureg;
 	struct i2c_client *client;
@@ -164,6 +163,7 @@ static int exynos_sata_phy_probe(struct platform_device *pdev)
 	struct device *dev = &pdev->dev;
 	struct phy_provider *phy_provider;
 	struct device_node *node;
+	struct clk *phyclk;
 	int ret = 0;
 
 	sata_phy = devm_kzalloc(dev, sizeof(*sata_phy), GFP_KERNEL);
@@ -193,16 +193,10 @@ static int exynos_sata_phy_probe(struct platform_device *pdev)
 
 	dev_set_drvdata(dev, sata_phy);
 
-	sata_phy->phyclk = devm_clk_get(dev, "sata_phyctrl");
-	if (IS_ERR(sata_phy->phyclk)) {
+	phyclk = devm_clk_get_enabled(dev, "sata_phyctrl");
+	if (IS_ERR(phyclk)) {
 		dev_err(dev, "failed to get clk for PHY\n");
-		ret = PTR_ERR(sata_phy->phyclk);
-		goto put_dev;
-	}
-
-	ret = clk_prepare_enable(sata_phy->phyclk);
-	if (ret < 0) {
-		dev_err(dev, "failed to enable source clk\n");
+		ret = PTR_ERR(phyclk);
 		goto put_dev;
 	}
 
@@ -210,7 +204,7 @@ static int exynos_sata_phy_probe(struct platform_device *pdev)
 	if (IS_ERR(sata_phy->phy)) {
 		dev_err(dev, "failed to create PHY\n");
 		ret = PTR_ERR(sata_phy->phy);
-		goto clk_disable;
+		goto put_dev;
 	}
 
 	phy_set_drvdata(sata_phy->phy, sata_phy);
@@ -219,13 +213,11 @@ static int exynos_sata_phy_probe(struct platform_device *pdev)
 					of_phy_simple_xlate);
 	if (IS_ERR(phy_provider)) {
 		ret = PTR_ERR(phy_provider);
-		goto clk_disable;
+		goto put_dev;
 	}
 
 	return 0;
 
-clk_disable:
-	clk_disable_unprepare(sata_phy->phyclk);
 put_dev:
 	put_device(&sata_phy->client->dev);
 
-- 
2.39.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ