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>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <d148c29a-6ffa-4f6b-8468-534b2b3a7c7a@wanadoo.fr>
Date: Mon, 26 Aug 2024 07:20:25 +0200
From: Christophe JAILLET <christophe.jaillet@...adoo.fr>
To: Wu Bo <bo.wu@...o.com>, linux-kernel@...r.kernel.org
Cc: Thomas Petazzoni <thomas.petazzoni@...tlin.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, linux-arm-kernel@...ts.infradead.org,
 Wu Bo <wubo.oduw@...il.com>
Subject: Re: [PATCH v2] PCI: armada8k: change to use devm_clk_get_enabled()
 helpers

Le 26/08/2024 à 04:00, Wu Bo a écrit :
> 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>
> ---
> 
> v2: use dev_err_probe() to handle error return
> 
>   drivers/pci/controller/dwc/pcie-armada8k.c | 36 ++++++++--------------
>   1 file changed, 13 insertions(+), 23 deletions(-)
> 
> diff --git a/drivers/pci/controller/dwc/pcie-armada8k.c b/drivers/pci/controller/dwc/pcie-armada8k.c
> index b5c599ccaacf..9708a6fde545 100644
> --- a/drivers/pci/controller/dwc/pcie-armada8k.c
> +++ b/drivers/pci/controller/dwc/pcie-armada8k.c
> @@ -284,23 +284,17 @@ static int armada8k_pcie_probe(struct platform_device *pdev)
>   
>   	pcie->pci = pci;
>   
> -	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);
> -
> -	ret = clk_prepare_enable(pcie->clk);
> -	if (ret)
> -		return ret;
> -
> -	pcie->clk_reg = devm_clk_get(dev, "reg");
> -	if (pcie->clk_reg == ERR_PTR(-EPROBE_DEFER)) {
> -		ret = -EPROBE_DEFER;
> -		goto fail;
> -	}
> -	if (!IS_ERR(pcie->clk_reg)) {
> -		ret = clk_prepare_enable(pcie->clk_reg);
> -		if (ret)
> -			goto fail_clkreg;
> +		return dev_err_probe(dev, PTR_ERR(pcie->clk),
> +				"could not enable clk\n");
> +
> +	pcie->clk_reg = devm_clk_get_enabled(dev, "reg");
> +	if (IS_ERR(pcie->clk_reg)) {
> +		ret = dev_err_probe(dev, -EPROBE_DEFER,

So ret = -EPROBE_DEFER after this line.

PTR_ERR(pcie->clk_reg) instead?

CJ


> +				"could not enable reg clk\n");
> +		if (ret == -EPROBE_DEFER)
> +			return ret;
>   	}
>   
>   	/* Get the dw-pcie unit configuration/control registers base. */
> @@ -308,12 +302,12 @@ static int armada8k_pcie_probe(struct platform_device *pdev)
>   	pci->dbi_base = devm_pci_remap_cfg_resource(dev, base);
>   	if (IS_ERR(pci->dbi_base)) {
>   		ret = PTR_ERR(pci->dbi_base);
> -		goto fail_clkreg;
> +		goto out;
>   	}
>   
>   	ret = armada8k_pcie_setup_phys(pcie);
>   	if (ret)
> -		goto fail_clkreg;
> +		goto out;
>   
>   	platform_set_drvdata(pdev, pcie);
>   
> @@ -325,11 +319,7 @@ static int armada8k_pcie_probe(struct platform_device *pdev)
>   
>   disable_phy:
>   	armada8k_pcie_disable_phys(pcie);
> -fail_clkreg:
> -	clk_disable_unprepare(pcie->clk_reg);
> -fail:
> -	clk_disable_unprepare(pcie->clk);
> -
> +out:
>   	return ret;
>   }
>   


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ