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] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240827012651.j2chqblkjha2vene@synopsys.com>
Date: Tue, 27 Aug 2024 01:26:56 +0000
From: Thinh Nguyen <Thinh.Nguyen@...opsys.com>
To: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
CC: Patrice Chotard <patrice.chotard@...s.st.com>,
        Thinh Nguyen <Thinh.Nguyen@...opsys.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Shawn Guo <shawnguo@...nel.org>, Sascha Hauer <s.hauer@...gutronix.de>,
        Pengutronix Kernel Team <kernel@...gutronix.de>,
        Fabio Estevam <festevam@...il.com>,
        Michal Simek <michal.simek@....com>,
        "linux-arm-kernel@...ts.infradead.org" <linux-arm-kernel@...ts.infradead.org>,
        "linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "imx@...ts.linux.dev" <imx@...ts.linux.dev>,
        "linux-arm-msm@...r.kernel.org" <linux-arm-msm@...r.kernel.org>
Subject: Re: [PATCH 04/11] usb: dwc3: imx8mp: simplify with
 devm_clk_get_enabled

On Wed, Aug 14, 2024, Krzysztof Kozlowski wrote:
> Use devm_clk_get_enabled() to drop clock preparing and handling from
> error and remove paths.  This makes the code a bit simpler.
> 
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
> ---
>  drivers/usb/dwc3/dwc3-imx8mp.c | 32 +++++---------------------------
>  1 file changed, 5 insertions(+), 27 deletions(-)
> 
> diff --git a/drivers/usb/dwc3/dwc3-imx8mp.c b/drivers/usb/dwc3/dwc3-imx8mp.c
> index 392fa1232788..8c91e595d3b9 100644
> --- a/drivers/usb/dwc3/dwc3-imx8mp.c
> +++ b/drivers/usb/dwc3/dwc3-imx8mp.c
> @@ -178,37 +178,23 @@ static int dwc3_imx8mp_probe(struct platform_device *pdev)
>  			return PTR_ERR(dwc3_imx->glue_base);
>  	}
>  
> -	dwc3_imx->hsio_clk = devm_clk_get(dev, "hsio");
> +	dwc3_imx->hsio_clk = devm_clk_get_enabled(dev, "hsio");
>  	if (IS_ERR(dwc3_imx->hsio_clk)) {
>  		err = PTR_ERR(dwc3_imx->hsio_clk);
>  		dev_err(dev, "Failed to get hsio clk, err=%d\n", err);
>  		return err;
>  	}
>  
> -	err = clk_prepare_enable(dwc3_imx->hsio_clk);
> -	if (err) {
> -		dev_err(dev, "Failed to enable hsio clk, err=%d\n", err);
> -		return err;
> -	}
> -
> -	dwc3_imx->suspend_clk = devm_clk_get(dev, "suspend");
> +	dwc3_imx->suspend_clk = devm_clk_get_enabled(dev, "suspend");
>  	if (IS_ERR(dwc3_imx->suspend_clk)) {
>  		err = PTR_ERR(dwc3_imx->suspend_clk);
>  		dev_err(dev, "Failed to get suspend clk, err=%d\n", err);
> -		goto disable_hsio_clk;
> -	}
> -
> -	err = clk_prepare_enable(dwc3_imx->suspend_clk);
> -	if (err) {
> -		dev_err(dev, "Failed to enable suspend clk, err=%d\n", err);
> -		goto disable_hsio_clk;
> +		return err;
>  	}
>  
>  	irq = platform_get_irq(pdev, 0);
> -	if (irq < 0) {
> -		err = irq;
> -		goto disable_clks;
> -	}
> +	if (irq < 0)
> +		return irq;
>  	dwc3_imx->irq = irq;
>  
>  	imx8mp_configure_glue(dwc3_imx);
> @@ -259,25 +245,17 @@ static int dwc3_imx8mp_probe(struct platform_device *pdev)
>  disable_rpm:
>  	pm_runtime_disable(dev);
>  	pm_runtime_put_noidle(dev);
> -disable_clks:
> -	clk_disable_unprepare(dwc3_imx->suspend_clk);
> -disable_hsio_clk:
> -	clk_disable_unprepare(dwc3_imx->hsio_clk);
>  
>  	return err;
>  }
>  
>  static void dwc3_imx8mp_remove(struct platform_device *pdev)
>  {
> -	struct dwc3_imx8mp *dwc3_imx = platform_get_drvdata(pdev);
>  	struct device *dev = &pdev->dev;
>  
>  	pm_runtime_get_sync(dev);
>  	of_platform_depopulate(dev);
>  
> -	clk_disable_unprepare(dwc3_imx->suspend_clk);
> -	clk_disable_unprepare(dwc3_imx->hsio_clk);
> -
>  	pm_runtime_disable(dev);
>  	pm_runtime_put_noidle(dev);
>  }
> 
> -- 
> 2.43.0
> 

Acked-by: Thinh Nguyen <Thinh.Nguyen@...opsys.com>

Thanks,
Thinh

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ