linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM: zx: zx296702-pm-domain.c: Fix check return value of devm_ioremap_resource
@ 2015-09-16  8:05 Axel Lin
  2015-09-16  8:39 ` Jun Nie
  0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2015-09-16  8:05 UTC (permalink / raw)
  To: linux-arm-kernel

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.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 arch/arm/mach-zx/zx296702-pm-domain.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/arch/arm/mach-zx/zx296702-pm-domain.c b/arch/arm/mach-zx/zx296702-pm-domain.c
index e08574d..17f778b 100644
--- a/arch/arm/mach-zx/zx296702-pm-domain.c
+++ b/arch/arm/mach-zx/zx296702-pm-domain.c
@@ -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);
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH] ARM: zx: zx296702-pm-domain.c: Fix check return value of devm_ioremap_resource
  2015-09-16  8:05 [PATCH] ARM: zx: zx296702-pm-domain.c: Fix check return value of devm_ioremap_resource Axel Lin
@ 2015-09-16  8:39 ` Jun Nie
  0 siblings, 0 replies; 2+ messages in thread
From: Jun Nie @ 2015-09-16  8:39 UTC (permalink / raw)
  To: linux-arm-kernel

2015-09-16 16:05 GMT+08:00 Axel Lin <axel.lin@ingics.com>:
> 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.
>
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> ---
>  arch/arm/mach-zx/zx296702-pm-domain.c | 11 ++---------
>  1 file changed, 2 insertions(+), 9 deletions(-)
>
> diff --git a/arch/arm/mach-zx/zx296702-pm-domain.c b/arch/arm/mach-zx/zx296702-pm-domain.c
> index e08574d..17f778b 100644
> --- a/arch/arm/mach-zx/zx296702-pm-domain.c
> +++ b/arch/arm/mach-zx/zx296702-pm-domain.c
> @@ -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);
> --
> 2.1.4
>
>
>
Reviewed-by: Jun Nie <jun.nie@linaro.org>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-09-16  8:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-16  8:05 [PATCH] ARM: zx: zx296702-pm-domain.c: Fix check return value of devm_ioremap_resource Axel Lin
2015-09-16  8:39 ` Jun Nie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).