]> Git Repo - linux.git/commitdiff
drivers/perf: arm-ccn: Use devm_ioremap_resource() to map memory
authorSudeep Holla <[email protected]>
Thu, 26 Jul 2018 11:23:31 +0000 (12:23 +0100)
committerWill Deacon <[email protected]>
Thu, 26 Jul 2018 12:33:49 +0000 (13:33 +0100)
Instead of checking the return value of platform_get_resource(), we can
use devm_ioremap_resource() which has the NULL pointer check and the
memory region requesting. devm_ioremap_resource is designed to replace
calls to devm_request_mem_region followed by devm_ioremap, so let's use
the same.

Cc: Will Deacon <[email protected]>
Cc: Mark Rutland <[email protected]>
Signed-off-by: Sudeep Holla <[email protected]>
Signed-off-by: Will Deacon <[email protected]>
drivers/perf/arm-ccn.c

index b416ee18e6bbcbea6466512ece04d591c45140fd..4b15c36f46311c44386b711d7ec31afe37127ac3 100644 (file)
@@ -1485,17 +1485,9 @@ static int arm_ccn_probe(struct platform_device *pdev)
        platform_set_drvdata(pdev, ccn);
 
        res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       if (!res)
-               return -EINVAL;
-
-       if (!devm_request_mem_region(ccn->dev, res->start,
-                       resource_size(res), pdev->name))
-               return -EBUSY;
-
-       ccn->base = devm_ioremap(ccn->dev, res->start,
-                               resource_size(res));
-       if (!ccn->base)
-               return -EFAULT;
+       ccn->base = devm_ioremap_resource(ccn->dev, res);
+       if (IS_ERR(ccn->base))
+               return PTR_ERR(ccn->base);
 
        res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
        if (!res)
This page took 0.063311 seconds and 4 git commands to generate.