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: <20240826021227.2206146-1-bo.wu@vivo.com>
Date: Sun, 25 Aug 2024 20:12:27 -0600
From: Wu Bo <bo.wu@...o.com>
To: linux-kernel@...r.kernel.org
Cc: Pratyush Anand <pratyush.anand@...il.com>,
	Lorenzo Pieralisi <lpieralisi@...nel.org>,
	Krzysztof WilczyƄski <kw@...ux.com>,
	Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>,
	Rob Herring <robh@...nel.org>,
	Bjorn Helgaas <bhelgaas@...gle.com>,
	linux-pci@...r.kernel.org,
	Wu Bo <wubo.oduw@...il.com>,
	Wu Bo <bo.wu@...o.com>
Subject: [PATCH v2] PCI: spear13xx: change to use devm_clk_get_enabled() helper

Use devm_clk_get_enabled() instead of devm_clk_get() to make the code
cleaner and avoid calling clk_disable_unprepare()

Signed-off-by: Wu Bo <bo.wu@...o.com>
---
 drivers/pci/controller/dwc/pcie-spear13xx.c | 18 ++----------------
 1 file changed, 2 insertions(+), 16 deletions(-)

diff --git a/drivers/pci/controller/dwc/pcie-spear13xx.c b/drivers/pci/controller/dwc/pcie-spear13xx.c
index 201dced209f0..37d9ccffc2e6 100644
--- a/drivers/pci/controller/dwc/pcie-spear13xx.c
+++ b/drivers/pci/controller/dwc/pcie-spear13xx.c
@@ -221,32 +221,18 @@ static int spear13xx_pcie_probe(struct platform_device *pdev)
 
 	phy_init(spear13xx_pcie->phy);
 
-	spear13xx_pcie->clk = devm_clk_get(dev, NULL);
+	spear13xx_pcie->clk = devm_clk_get_enabled(dev, NULL);
 	if (IS_ERR(spear13xx_pcie->clk)) {
 		dev_err(dev, "couldn't get clk for pcie\n");
 		return PTR_ERR(spear13xx_pcie->clk);
 	}
-	ret = clk_prepare_enable(spear13xx_pcie->clk);
-	if (ret) {
-		dev_err(dev, "couldn't enable clk for pcie\n");
-		return ret;
-	}
 
 	if (of_property_read_bool(np, "st,pcie-is-gen1"))
 		pci->link_gen = 1;
 
 	platform_set_drvdata(pdev, spear13xx_pcie);
 
-	ret = spear13xx_add_pcie_port(spear13xx_pcie, pdev);
-	if (ret < 0)
-		goto fail_clk;
-
-	return 0;
-
-fail_clk:
-	clk_disable_unprepare(spear13xx_pcie->clk);
-
-	return ret;
+	return spear13xx_add_pcie_port(spear13xx_pcie, pdev);
 }
 
 static const struct of_device_id spear13xx_pcie_of_match[] = {
-- 
2.25.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ