[PATCH -next] ARM: zx: use devm_platform_ioremap_resource

Qinglang Miao miaoqinglang at huawei.com
Wed Sep 16 02:21:20 EDT 2020


Use the helper function that wraps the calls to platform_get_resource()
and devm_ioremap_resource() together. Note that error handling on the
result of a call to platform_get_resource() is unneeded either when the
value is passed to devm_ioremap_resource(), so remove it.

Signed-off-by: Qinglang Miao <miaoqinglang at huawei.com>
---
 arch/arm/mach-zx/zx296702-pm-domain.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/arch/arm/mach-zx/zx296702-pm-domain.c b/arch/arm/mach-zx/zx296702-pm-domain.c
index ac44ea8e6..8ddc94530 100644
--- a/arch/arm/mach-zx/zx296702-pm-domain.c
+++ b/arch/arm/mach-zx/zx296702-pm-domain.c
@@ -152,7 +152,6 @@ static struct generic_pm_domain *zx296702_pm_domains[] = {
 static int zx296702_pd_probe(struct platform_device *pdev)
 {
 	struct genpd_onecell_data *genpd_data;
-	struct resource *res;
 	int i;
 
 	genpd_data = devm_kzalloc(&pdev->dev, sizeof(*genpd_data), GFP_KERNEL);
@@ -162,13 +161,7 @@ static int zx296702_pd_probe(struct platform_device *pdev)
 	genpd_data->domains = zx296702_pm_domains;
 	genpd_data->num_domains = ARRAY_SIZE(zx296702_pm_domains);
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!res) {
-		dev_err(&pdev->dev, "no memory resource defined\n");
-		return -ENODEV;
-	}
-
-	pcubase = devm_ioremap_resource(&pdev->dev, res);
+	pcubase = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(pcubase))
 		return -EIO;
 
-- 
2.23.0




More information about the linux-arm-kernel mailing list