Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1453010 > unrolled thread

[PATCH] iommu/exynos: Modify error handling

Started byAmitoj Kaur Chawla <amitoj1606@gmail.com>
First post2016-08-01 09:20 +0200
Last post2016-08-09 17:30 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] iommu/exynos: Modify error handling Amitoj Kaur Chawla <amitoj1606@gmail.com> - 2016-08-01 09:20 +0200
    Re: [PATCH] iommu/exynos: Modify error handling Joerg Roedel <joro@8bytes.org> - 2016-08-09 17:30 +0200

#1453010 — [PATCH] iommu/exynos: Modify error handling

FromAmitoj Kaur Chawla <amitoj1606@gmail.com>
Date2016-08-01 09:20 +0200
Subject[PATCH] iommu/exynos: Modify error handling
Message-ID<s1fG2-3cM-3@gated-at.bofh.it>
of_platform_device_create returns NULL on error so an IS_ERR test is
incorrect here and a NULL check is required.

The Coccinelle semantic patch used to make this change is as follows:
@@
expression e;
@@

  e = of_platform_device_create(...);
if(
-    IS_ERR(e)
+    !e
    )
    {
  <+...
  return
- PTR_ERR(e)
+ -ENODEV
  ;
  ...+>
  }

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
---
 drivers/iommu/exynos-iommu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c
index 97c41b8..2888bbf 100644
--- a/drivers/iommu/exynos-iommu.c
+++ b/drivers/iommu/exynos-iommu.c
@@ -1242,8 +1242,8 @@ static int __init exynos_iommu_of_setup(struct device_node *np)
 		exynos_iommu_init();
 
 	pdev = of_platform_device_create(np, NULL, platform_bus_type.dev_root);
-	if (IS_ERR(pdev))
-		return PTR_ERR(pdev);
+	if (!pdev)
+		return -ENODEV;
 
 	of_iommu_set_ops(np, &exynos_iommu_ops);
 	return 0;
-- 
1.9.1

[toc] | [next] | [standalone]


#1458853

FromJoerg Roedel <joro@8bytes.org>
Date2016-08-09 17:30 +0200
Message-ID<s4h8C-UE-17@gated-at.bofh.it>
In reply to#1453010
On Mon, Aug 01, 2016 at 11:48:38AM +0530, Amitoj Kaur Chawla wrote:
> of_platform_device_create returns NULL on error so an IS_ERR test is
> incorrect here and a NULL check is required.
> 
> The Coccinelle semantic patch used to make this change is as follows:
> @@
> expression e;
> @@
> 
>   e = of_platform_device_create(...);
> if(
> -    IS_ERR(e)
> +    !e
>     )
>     {
>   <+...
>   return
> - PTR_ERR(e)
> + -ENODEV
>   ;
>   ...+>
>   }
> 
> Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
> ---
>  drivers/iommu/exynos-iommu.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Patch didn't apply cleanly against v4.8-rc1, but I fixed it up and it is
now in my tree, thanks.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web