hwrng: atmel - use devm_platform_ioremap_resource() to simplify code
authorYueHaibing <yuehaibing@huawei.com>
Wed, 16 Oct 2019 10:46:09 +0000 (18:46 +0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 25 Oct 2019 15:09:53 +0000 (02:09 +1100)
Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/char/hw_random/atmel-rng.c

index e55705745d5e42bf2b368ae231cfa5247bf2e628..b3138ec26f8569c05e72c04a84295c3e00d6f54a 100644 (file)
@@ -62,15 +62,13 @@ static void atmel_trng_disable(struct atmel_trng *trng)
 static int atmel_trng_probe(struct platform_device *pdev)
 {
        struct atmel_trng *trng;
-       struct resource *res;
        int ret;
 
        trng = devm_kzalloc(&pdev->dev, sizeof(*trng), GFP_KERNEL);
        if (!trng)
                return -ENOMEM;
 
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       trng->base = devm_ioremap_resource(&pdev->dev, res);
+       trng->base = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(trng->base))
                return PTR_ERR(trng->base);