Skip to contentSkip to conversation

ARM: zx: zx296702-pm-domain.c: Fix check return value of devm_ioremap_resource

PATCH Superseded Axel Lin 2 participants 2 messages Sep 16, 2015

Subsystems (2)
lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 ARM: zx: zx296702-pm-domain.c: Fix check return value of devm_ioremap_resource

devm_ioremap_resource() returns ERR_PTR on failure. devm_ioremap_resource() will also check res argument and show proper error on error path, so remove the redundant checking for res and error messages.

---
 arch/arm/mach-zx/zx296702-pm-domain.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)
arch/arm/mach-zx/zx296702-pm-domain.c +2 -9
index e08574d..17f778b 100644
@@ -163,16 +163,9 @@ static int zx296702_pd_probe(struct platform_device *pdev)
 	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);
-	if (!pcubase) {
-		dev_err(&pdev->dev, "ioremap fail.\n");
-		return -EIO;
-	}
+	if (IS_ERR(pcubase))
+		return PTR_ERR(pcubase);
 
 	for (i = 0; i < ARRAY_SIZE(zx296702_pm_domains); ++i)
 		pm_genpd_init(zx296702_pm_domains[i], NULL, false);
Signature · 1 line
2.1.4
#1 lore raw

PATCH 1/1 ARM: zx: zx296702-pm-domain.c: Fix check return value of devm_ioremap_resource

2015-09-16 16:05 GMT+08:00 Axel Lin <[email protected]>:

Quoted 33 lines

devm_ioremap_resource() returns ERR_PTR on failure. devm_ioremap_resource() will also check res argument and show proper error on error path, so remove the redundant checking for res and error messages.

---
 arch/arm/mach-zx/zx296702-pm-domain.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)
arch/arm/mach-zx/zx296702-pm-domain.c +2 -10
index e08574d..17f778b 100644
@@ -163,16 +163,9 @@ static int zx296702_pd_probe(struct platform_device *pdev)
        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);
-       if (!pcubase) {
-               dev_err(&pdev->dev, "ioremap fail.\n");
-               return -EIO;
-       }
+       if (IS_ERR(pcubase))
+               return PTR_ERR(pcubase);
 
        for (i = 0; i < ARRAY_SIZE(zx296702_pm_domains); ++i)
                pm_genpd_init(zx296702_pm_domains[i], NULL, false);
--
Quoted 4 lines

2.1.4