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: <20191105174753.GH17620@lunn.ch>
Date:   Tue, 5 Nov 2019 18:47:53 +0100
From:   Andrew Lunn <andrew@...n.ch>
To:     Christophe Roullier <christophe.roullier@...com>
Cc:     robh@...nel.org, davem@...emloft.net, joabreu@...opsys.com,
        mark.rutland@....com, mcoquelin.stm32@...il.com,
        alexandre.torgue@...com, peppe.cavallaro@...com,
        linux-stm32@...md-mailman.stormreply.com,
        linux-kernel@...r.kernel.org, devicetree@...r.kernel.org,
        linux-arm-kernel@...ts.infradead.org, netdev@...r.kernel.org
Subject: Re: [PATCH V2 net-next 1/4] net: ethernet: stmmac: Add support for
 syscfg clock

On Tue, Nov 05, 2019 at 01:45:02PM +0100, Christophe Roullier wrote:
> Add optional support for syscfg clock in dwmac-stm32.c
> Now Syscfg clock is activated automatically when syscfg
> registers are used
> 
> Signed-off-by: Christophe Roullier <christophe.roullier@...com>
> ---
>  .../net/ethernet/stmicro/stmmac/dwmac-stm32.c | 32 ++++++++++++-------
>  1 file changed, 21 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c
> index 4ef041bdf6a1..df7e9e913041 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c
> @@ -152,19 +152,24 @@ static int stm32mp1_clk_prepare(struct stm32_dwmac *dwmac, bool prepare)
>  	int ret = 0;
>  
>  	if (prepare) {
> -		ret = clk_prepare_enable(dwmac->syscfg_clk);
> -		if (ret)
> -			return ret;
> -
> +		if (dwmac->syscfg_clk) {
> +			ret = clk_prepare_enable(dwmac->syscfg_clk);
> +			if (ret)
> +				return ret;
> +		}

Hi Christophe

All the clk_ API functions are happy to take a NULL point and then do
nothing. So you don't need these changes. 

> -	/*  Clock for sysconfig */
> +	/*  Optional Clock for sysconfig */
>  	dwmac->syscfg_clk = devm_clk_get(dev, "syscfg-clk");
>  	if (IS_ERR(dwmac->syscfg_clk)) {
> -		dev_err(dev, "No syscfg clock provided...\n");
> -		return PTR_ERR(dwmac->syscfg_clk);
> +		err = PTR_ERR(dwmac->syscfg_clk);
> +		if (err != -ENOENT)
> +			return err;
> +		dwmac->syscfg_clk = NULL;
>  	}
>  
> +	err = 0;
> +

That should be all you need. Just set dwmac->syscfg_clk to NULL and
the rest should work.

    Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ