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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 12 Mar 2013 20:04:48 +0800
From:	Shawn Guo <shawn.guo@...aro.org>
To:	Fabio Estevam <festevam@...il.com>
CC:	<vinod.koul@...el.com>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] dma: mxs-dma: Convert to devm_ioremap_resource()

On Mon, Mar 11, 2013 at 08:50:33PM -0300, Fabio Estevam wrote:
> Converting to devm_ioremap_resource() can make the code cleaner and smaller.
> 
While you are there, you may want to use devm_kzalloc() and
devm_clk_get() as well.

Shawn

> Signed-off-by: Fabio Estevam <festevam@...il.com>
> ---
>  drivers/dma/mxs-dma.c |   18 ++++--------------
>  1 file changed, 4 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/dma/mxs-dma.c b/drivers/dma/mxs-dma.c
> index 8f6d30d..8a9939e4 100644
> --- a/drivers/dma/mxs-dma.c
> +++ b/drivers/dma/mxs-dma.c
> @@ -689,16 +689,9 @@ static int __init mxs_dma_probe(struct platform_device *pdev)
>  	mxs_dma->dev_id = dma_type->id;
>  
>  	iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -
> -	if (!request_mem_region(iores->start, resource_size(iores),
> -				pdev->name)) {
> -		ret = -EBUSY;
> -		goto err_request_region;
> -	}
> -
> -	mxs_dma->base = ioremap(iores->start, resource_size(iores));
> -	if (!mxs_dma->base) {
> -		ret = -ENOMEM;
> +	mxs_dma->base = devm_ioremap_resource(&pdev->dev, iores);
> +	if (IS_ERR(mxs_dma->base)) {
> +		ret = PTR_ERR(mxs_dma->base);
>  		goto err_ioremap;
>  	}
>  
> @@ -761,10 +754,7 @@ static int __init mxs_dma_probe(struct platform_device *pdev)
>  err_init:
>  	clk_put(mxs_dma->clk);
>  err_clk:
> -	iounmap(mxs_dma->base);
> -err_ioremap:
> -	release_mem_region(iores->start, resource_size(iores));
> -err_request_region:
> +err_ioremap:
>  	kfree(mxs_dma);
>  	return ret;
>  }
> -- 
> 1.7.9.5
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists