Commit 8fb7bd31 authored by Tian Tao's avatar Tian Tao Committed by Herbert Xu

hwrng: xiphera-trng - use devm_platform_ioremap_resource() to simplify

Use devm_platform_ioremap_resource() to simplify the code.
Signed-off-by: default avatarTian Tao <tiantao6@hisilicon.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 6131e970
...@@ -63,14 +63,12 @@ static int xiphera_trng_probe(struct platform_device *pdev) ...@@ -63,14 +63,12 @@ static int xiphera_trng_probe(struct platform_device *pdev)
int ret; int ret;
struct xiphera_trng *trng; struct xiphera_trng *trng;
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct resource *res;
trng = devm_kzalloc(dev, sizeof(*trng), GFP_KERNEL); trng = devm_kzalloc(dev, sizeof(*trng), GFP_KERNEL);
if (!trng) if (!trng)
return -ENOMEM; return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); trng->mem = devm_platform_ioremap_resource(pdev, 0);
trng->mem = devm_ioremap_resource(dev, res);
if (IS_ERR(trng->mem)) if (IS_ERR(trng->mem))
return PTR_ERR(trng->mem); return PTR_ERR(trng->mem);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment