summaryrefslogtreecommitdiff
path: root/drivers/char
diff options
context:
space:
mode:
authorJingoo Han <jg1.han@samsung.com>2014-02-12 09:17:08 +0400
committerHerbert Xu <herbert@gondor.apana.org.au>2014-02-27 01:56:50 +0400
commitbfaff75b09c42d8fc57b020034e836fe9048f8b1 (patch)
tree84ece2a5e06170aef541be849c06b708bed6ac3a /drivers/char
parent0fdefe2c907610f3efb3163c8b72127007e282aa (diff)
downloadlinux-bfaff75b09c42d8fc57b020034e836fe9048f8b1.tar.xz
hwrng: atmel - Use devm_ioremap_resource()
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: Peter Korsgaard <jacmet@sunsite.dk> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/hw_random/atmel-rng.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/drivers/char/hw_random/atmel-rng.c b/drivers/char/hw_random/atmel-rng.c
index bf9fc6b79328..dfeddf2c00b7 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))