public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nicolas Ferre <nicolas.ferre@atmel.com>
To: Jingoo Han <jg1.han@samsung.com>,
	"'Herbert Xu'" <herbert@gondor.apana.org.au>
Cc: <linux-kernel@vger.kernel.org>, "'Peter Korsgaard'" <jacmet@sunsite.dk>
Subject: Re: [PATCH 1/2] hwrng: atmel - Use devm_ioremap_resource()
Date: Wed, 12 Feb 2014 09:12:37 +0100	[thread overview]
Message-ID: <52FB2CF5.8020503@atmel.com> (raw)
In-Reply-To: <000001cf27b1$acf29f30$06d7dd90$%han@samsung.com>

On 12/02/2014 06:17, Jingoo Han :
> Use devm_ioremap_resource() in order to make the code simpler,
> and remove redundant return value check of platform_get_resource()
> because the value is checked by devm_ioremap_resource().
> 
> Signed-off-by: Jingoo Han <jg1.han@samsung.com>

Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>

Thanks! Bye,

> ---
>  drivers/char/hw_random/atmel-rng.c |   15 ++++-----------
>  1 file changed, 4 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/char/hw_random/atmel-rng.c b/drivers/char/hw_random/atmel-rng.c
> index bf9fc6b..dfeddf2 100644
> --- a/drivers/char/hw_random/atmel-rng.c
> +++ b/drivers/char/hw_random/atmel-rng.c
> @@ -54,21 +54,14 @@ static int atmel_trng_probe(struct platform_device *pdev)
>  	struct resource *res;
>  	int ret;
>  
> -	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -	if (!res)
> -		return -EINVAL;
> -
>  	trng = devm_kzalloc(&pdev->dev, sizeof(*trng), GFP_KERNEL);
>  	if (!trng)
>  		return -ENOMEM;
>  
> -	if (!devm_request_mem_region(&pdev->dev, res->start,
> -				     resource_size(res), pdev->name))
> -		return -EBUSY;
> -
> -	trng->base = devm_ioremap(&pdev->dev, res->start, resource_size(res));
> -	if (!trng->base)
> -		return -EBUSY;
> +	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> +	trng->base = devm_ioremap_resource(&pdev->dev, res);
> +	if (IS_ERR(trng->base))
> +		return PTR_ERR(trng->base);
>  
>  	trng->clk = clk_get(&pdev->dev, NULL);
>  	if (IS_ERR(trng->clk))
> 


-- 
Nicolas Ferre

  parent reply	other threads:[~2014-02-12  8:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-12  5:17 [PATCH 1/2] hwrng: atmel - Use devm_ioremap_resource() Jingoo Han
2014-02-12  5:19 ` [PATCH 2/2] hwrng: pixocell " Jingoo Han
2014-02-12  7:46 ` [PATCH 1/2] hwrng: atmel " Peter Korsgaard
2014-02-12  8:12 ` Nicolas Ferre [this message]
2014-02-25 12:17 ` Herbert Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52FB2CF5.8020503@atmel.com \
    --to=nicolas.ferre@atmel.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=jacmet@sunsite.dk \
    --cc=jg1.han@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox