hwrng: ba431 - use devm_platform_ioremap_resource() to simplify

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>
This commit is contained in:
Tian Tao 2021-03-13 09:47:38 +08:00 committed by Herbert Xu
parent f50281df94
commit 682689a56e

View File

@ -170,7 +170,6 @@ static int ba431_trng_init(struct hwrng *rng)
static int ba431_trng_probe(struct platform_device *pdev) static int ba431_trng_probe(struct platform_device *pdev)
{ {
struct ba431_trng *ba431; struct ba431_trng *ba431;
struct resource *res;
int ret; int ret;
ba431 = devm_kzalloc(&pdev->dev, sizeof(*ba431), GFP_KERNEL); ba431 = devm_kzalloc(&pdev->dev, sizeof(*ba431), GFP_KERNEL);
@ -179,8 +178,7 @@ static int ba431_trng_probe(struct platform_device *pdev)
ba431->dev = &pdev->dev; ba431->dev = &pdev->dev;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ba431->base = devm_platform_ioremap_resource(pdev, 0);
ba431->base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(ba431->base)) if (IS_ERR(ba431->base))
return PTR_ERR(ba431->base); return PTR_ERR(ba431->base);