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: <20240827121147.00006444@Huawei.com>
Date: Tue, 27 Aug 2024 12:11:47 +0100
From: Jonathan Cameron <Jonathan.Cameron@...wei.com>
To: Yangtao Li <frank.li@...o.com>
CC: <clement.leger@...tlin.com>, <andrew@...n.ch>, <f.fainelli@...il.com>,
	<olteanv@...il.com>, <davem@...emloft.net>, <edumazet@...gle.com>,
	<kuba@...nel.org>, <pabeni@...hat.com>, <ulli.kroll@...glemail.com>,
	<linus.walleij@...aro.org>, <marcin.s.wojtas@...il.com>,
	<linux@...linux.org.uk>, <alexandre.torgue@...s.st.com>,
	<joabreu@...opsys.com>, <mcoquelin.stm32@...il.com>, <hkallweit1@...il.com>,
	<u.kleine-koenig@...gutronix.de>, <jacob.e.keller@...el.com>,
	<justinstitt@...gle.com>, <sd@...asysnail.net>, <horms@...nel.org>,
	<linux-renesas-soc@...r.kernel.org>, <netdev@...r.kernel.org>,
	<linux-kernel@...r.kernel.org>, <linux-arm-kernel@...ts.infradead.org>,
	<linux-stm32@...md-mailman.stormreply.com>
Subject: Re: [net-next v3 9/9] net: marvell: pxa168_eth: Convert to
 devm_clk_get_enabled()

On Tue, 27 Aug 2024 03:57:12 -0600
Yangtao Li <frank.li@...o.com> wrote:

> Convert devm_clk_get(), clk_prepare_enable() to a single
> call to devm_clk_get_enabled(), as this is exactly
> what this function does.
> 
> Signed-off-by: Yangtao Li <frank.li@...o.com>
Ordering in here is already 'interesting' but I'd still look
at more devm_ calls for the mdio and netdev parts.

> ---
>  drivers/net/ethernet/marvell/pxa168_eth.c | 17 ++++-------------
>  1 file changed, 4 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/net/ethernet/marvell/pxa168_eth.c b/drivers/net/ethernet/marvell/pxa168_eth.c
> index 1a59c952aa01..bad91cc705e8 100644
> --- a/drivers/net/ethernet/marvell/pxa168_eth.c
> +++ b/drivers/net/ethernet/marvell/pxa168_eth.c
> @@ -237,8 +237,6 @@ struct pxa168_eth_private {
>  	struct timer_list timeout;
>  	struct mii_bus *smi_bus;
>  
> -	/* clock */
> -	struct clk *clk;
>  	struct pxa168_eth_platform_data *pd;
>  	/*
>  	 * Ethernet controller base address.
> @@ -1394,23 +1392,19 @@ static int pxa168_eth_probe(struct platform_device *pdev)
>  
>  	printk(KERN_NOTICE "PXA168 10/100 Ethernet Driver\n");
>  
> -	clk = devm_clk_get(&pdev->dev, NULL);
> +	clk = devm_clk_get_enabled(&pdev->dev, NULL);
>  	if (IS_ERR(clk)) {
>  		dev_err(&pdev->dev, "Fast Ethernet failed to get clock\n");
> -		return -ENODEV;
> +		return PTR_ERR(clk);
>  	}
> -	clk_prepare_enable(clk);
>  
>  	dev = alloc_etherdev(sizeof(struct pxa168_eth_private));
> -	if (!dev) {
> -		err = -ENOMEM;
> -		goto err_clk;
> -	}
> +	if (!dev)
> +		return -ENOMEM;
>  
>  	platform_set_drvdata(pdev, dev);
>  	pep = netdev_priv(dev);
>  	pep->dev = dev;
> -	pep->clk = clk;
>  
>  	pep->base = devm_platform_ioremap_resource(pdev, 0);
>  	if (IS_ERR(pep->base)) {
> @@ -1523,8 +1517,6 @@ static int pxa168_eth_probe(struct platform_device *pdev)
>  	mdiobus_free(pep->smi_bus);
>  err_netdev:
>  	free_netdev(dev);
> -err_clk:
> -	clk_disable_unprepare(clk);
>  	return err;
>  }
>  
> @@ -1542,7 +1534,6 @@ static void pxa168_eth_remove(struct platform_device *pdev)
>  	if (dev->phydev)
>  		phy_disconnect(dev->phydev);
>  
> -	clk_disable_unprepare(pep->clk);
>  	mdiobus_unregister(pep->smi_bus);
>  	mdiobus_free(pep->smi_bus);
>  	unregister_netdev(dev);


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ