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: <f485a7b2-5bbf-1dfa-ea54-553db85c7ddb@amd.com>
Date:   Wed, 21 Aug 2019 13:32:34 +0000
From:   "Lendacky, Thomas" <Thomas.Lendacky@....com>
To:     YueHaibing <yuehaibing@...wei.com>,
        "davem@...emloft.net" <davem@...emloft.net>
CC:     "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: [PATCH net-next] amd-xgbe: use devm_platform_ioremap_resource()
 to simplify code

On 8/21/19 7:32 AM, YueHaibing wrote:
> Use devm_platform_ioremap_resource() to simplify the code a bit.
> This is detected by coccinelle.
> 
> Reported-by: Hulk Robot <hulkci@...wei.com>
> Signed-off-by: YueHaibing <yuehaibing@...wei.com>

Acked-by: Tom Lendacky <thomas.lendacky@....com>

> ---
>  drivers/net/ethernet/amd/xgbe/xgbe-platform.c | 19 ++++++++-----------
>  1 file changed, 8 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-platform.c b/drivers/net/ethernet/amd/xgbe/xgbe-platform.c
> index dce9e59..4ebd241 100644
> --- a/drivers/net/ethernet/amd/xgbe/xgbe-platform.c
> +++ b/drivers/net/ethernet/amd/xgbe/xgbe-platform.c
> @@ -301,7 +301,6 @@ static int xgbe_platform_probe(struct platform_device *pdev)
>  	struct xgbe_prv_data *pdata;
>  	struct device *dev = &pdev->dev;
>  	struct platform_device *phy_pdev;
> -	struct resource *res;
>  	const char *phy_mode;
>  	unsigned int phy_memnum, phy_irqnum;
>  	unsigned int dma_irqnum, dma_irqend;
> @@ -353,8 +352,7 @@ static int xgbe_platform_probe(struct platform_device *pdev)
>  	}
>  
>  	/* Obtain the mmio areas for the device */
> -	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -	pdata->xgmac_regs = devm_ioremap_resource(dev, res);
> +	pdata->xgmac_regs = devm_platform_ioremap_resource(pdev, 0);
>  	if (IS_ERR(pdata->xgmac_regs)) {
>  		dev_err(dev, "xgmac ioremap failed\n");
>  		ret = PTR_ERR(pdata->xgmac_regs);
> @@ -363,8 +361,7 @@ static int xgbe_platform_probe(struct platform_device *pdev)
>  	if (netif_msg_probe(pdata))
>  		dev_dbg(dev, "xgmac_regs = %p\n", pdata->xgmac_regs);
>  
> -	res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
> -	pdata->xpcs_regs = devm_ioremap_resource(dev, res);
> +	pdata->xpcs_regs = devm_platform_ioremap_resource(pdev, 1);
>  	if (IS_ERR(pdata->xpcs_regs)) {
>  		dev_err(dev, "xpcs ioremap failed\n");
>  		ret = PTR_ERR(pdata->xpcs_regs);
> @@ -373,8 +370,8 @@ static int xgbe_platform_probe(struct platform_device *pdev)
>  	if (netif_msg_probe(pdata))
>  		dev_dbg(dev, "xpcs_regs  = %p\n", pdata->xpcs_regs);
>  
> -	res = platform_get_resource(phy_pdev, IORESOURCE_MEM, phy_memnum++);
> -	pdata->rxtx_regs = devm_ioremap_resource(dev, res);
> +	pdata->rxtx_regs = devm_platform_ioremap_resource(phy_pdev,
> +							  phy_memnum++);
>  	if (IS_ERR(pdata->rxtx_regs)) {
>  		dev_err(dev, "rxtx ioremap failed\n");
>  		ret = PTR_ERR(pdata->rxtx_regs);
> @@ -383,8 +380,8 @@ static int xgbe_platform_probe(struct platform_device *pdev)
>  	if (netif_msg_probe(pdata))
>  		dev_dbg(dev, "rxtx_regs  = %p\n", pdata->rxtx_regs);
>  
> -	res = platform_get_resource(phy_pdev, IORESOURCE_MEM, phy_memnum++);
> -	pdata->sir0_regs = devm_ioremap_resource(dev, res);
> +	pdata->sir0_regs = devm_platform_ioremap_resource(phy_pdev,
> +							  phy_memnum++);
>  	if (IS_ERR(pdata->sir0_regs)) {
>  		dev_err(dev, "sir0 ioremap failed\n");
>  		ret = PTR_ERR(pdata->sir0_regs);
> @@ -393,8 +390,8 @@ static int xgbe_platform_probe(struct platform_device *pdev)
>  	if (netif_msg_probe(pdata))
>  		dev_dbg(dev, "sir0_regs  = %p\n", pdata->sir0_regs);
>  
> -	res = platform_get_resource(phy_pdev, IORESOURCE_MEM, phy_memnum++);
> -	pdata->sir1_regs = devm_ioremap_resource(dev, res);
> +	pdata->sir1_regs = devm_platform_ioremap_resource(phy_pdev,
> +							  phy_memnum++);
>  	if (IS_ERR(pdata->sir1_regs)) {
>  		dev_err(dev, "sir1 ioremap failed\n");
>  		ret = PTR_ERR(pdata->sir1_regs);
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ