hwrng: xiphera-trng - use devm_platform_ioremap_resource() to simplify
authorTian Tao <tiantao6@hisilicon.com>
Tue, 9 Feb 2021 08:03:37 +0000 (16:03 +0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Sun, 7 Mar 2021 04:13:14 +0000 (15:13 +1100)
Use devm_platform_ioremap_resource() to simplify the code.

Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/char/hw_random/xiphera-trng.c

index 7bdab8c8a6a8f40b719574750e552a82a95b7cd4..2a9fea72b2e0d0bc7426b0a5831fff0ffc078614 100644 (file)
@@ -63,14 +63,12 @@ static int xiphera_trng_probe(struct platform_device *pdev)
        int ret;
        struct xiphera_trng *trng;
        struct device *dev = &pdev->dev;
-       struct resource *res;
 
        trng = devm_kzalloc(dev, sizeof(*trng), GFP_KERNEL);
        if (!trng)
                return -ENOMEM;
 
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       trng->mem = devm_ioremap_resource(dev, res);
+       trng->mem = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(trng->mem))
                return PTR_ERR(trng->mem);