mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	Bharat Kumar Gogada <bharat.kumar.gogada@xilinx.com>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Hyun Kwon <hyun.kwon@xilinx.com>,
	Lorenzo Pieralisi <lpieralisi@kernel.org>,
	Manivannan Sadhasivam <mani@kernel.org>,
	Michal Simek <michal.simek@amd.com>,
	Rob Herring <robh@kernel.org>,
	Sean Anderson <sean.anderson@linux.dev>
Cc: LKML <linux-kernel@vger.kernel.org>,
	kernel-janitors@vger.kernel.org,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Christophe Jaillet <christophe.jaillet@wanadoo.fr>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Frank Li <Frank.Li@kernel.org>
Subject: [PATCH] PCI: xilinx-nwl: Use devm_clk_get_enabled() in nwl_pcie_probe()
Date: Sun, 22 Nov 2026 20:52:11 +0100	[thread overview]
Message-ID: <f691bbaa-ddb5-45bf-8f85-fcf354a6af03@web.de> (raw)

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 22 Nov 2026 20:35:35 +0100

* Reuse existing functionality from devm_clk_get_enabled() instead of
  keeping duplicate source code.

* Omit a clk_disable_unprepare() call on an error handling path
  and in the implementation of the function “nwl_pcie_remove”.

* Delete the label “err_clk”.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/pci/controller/pcie-xilinx-nwl.c | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/drivers/pci/controller/pcie-xilinx-nwl.c b/drivers/pci/controller/pcie-xilinx-nwl.c
index 0dee19fa24ca..fd134317e9c4 100644
--- a/drivers/pci/controller/pcie-xilinx-nwl.c
+++ b/drivers/pci/controller/pcie-xilinx-nwl.c
@@ -844,20 +844,14 @@ static int nwl_pcie_probe(struct platform_device *pdev)
 		return err;
 	}
 
-	pcie->clk = devm_clk_get(dev, NULL);
+	pcie->clk = devm_clk_get_enabled(dev, NULL);
 	if (IS_ERR(pcie->clk))
 		return PTR_ERR(pcie->clk);
 
-	err = clk_prepare_enable(pcie->clk);
-	if (err) {
-		dev_err(dev, "can't enable PCIe ref clock\n");
-		return err;
-	}
-
 	err = nwl_pcie_phy_enable(pcie);
 	if (err) {
 		dev_err(dev, "could not enable PHYs\n");
-		goto err_clk;
+		return err;
 	}
 
 	err = nwl_pcie_bridge_init(pcie);
@@ -889,8 +883,6 @@ static int nwl_pcie_probe(struct platform_device *pdev)
 
 err_phy:
 	nwl_pcie_phy_disable(pcie);
-err_clk:
-	clk_disable_unprepare(pcie->clk);
 	return err;
 }
 
@@ -899,7 +891,6 @@ static void nwl_pcie_remove(struct platform_device *pdev)
 	struct nwl_pcie *pcie = platform_get_drvdata(pdev);
 
 	nwl_pcie_phy_disable(pcie);
-	clk_disable_unprepare(pcie->clk);
 }
 
 static struct platform_driver nwl_pcie_driver = {
-- 
2.56.1


                 reply	other threads:[~2026-11-22 19:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f691bbaa-ddb5-45bf-8f85-fcf354a6af03@web.de \
    --to=markus.elfring@web.de \
    --cc=Frank.Li@kernel.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=bharat.kumar.gogada@xilinx.com \
    --cc=bhelgaas@google.com \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=f.fainelli@gmail.com \
    --cc=hyun.kwon@xilinx.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=mani@kernel.org \
    --cc=michal.simek@amd.com \
    --cc=robh@kernel.org \
    --cc=sean.anderson@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®