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


Groups > linux.kernel > #1447227 > unrolled thread

[PATCH] cxl: Delete an unnecessary check before the function call "of_node_put"

Started bySF Markus Elfring <elfring@users.sourceforge.net>
First post2016-07-20 15:30 +0200
Last post2016-07-20 15:40 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH] cxl: Delete an unnecessary check before the function call  "of_node_put" SF Markus Elfring <elfring@users.sourceforge.net> - 2016-07-20 15:30 +0200
    Re: [PATCH] cxl: Delete an unnecessary check before the function  call "of_node_put" Julia Lawall <julia.lawall@lip6.fr> - 2016-07-20 15:40 +0200

#1447227 — [PATCH] cxl: Delete an unnecessary check before the function call "of_node_put"

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2016-07-20 15:30 +0200
Subject[PATCH] cxl: Delete an unnecessary check before the function call "of_node_put"
Message-ID<rWZJv-1YB-11@gated-at.bofh.it>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 20 Jul 2016 15:10:32 +0200

The of_node_put() function tests whether its argument is NULL
and then returns immediately.
Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/misc/cxl/of.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/misc/cxl/of.c b/drivers/misc/cxl/of.c
index edc4583..333256a 100644
--- a/drivers/misc/cxl/of.c
+++ b/drivers/misc/cxl/of.c
@@ -490,8 +490,7 @@ int cxl_of_probe(struct platform_device *pdev)
 		adapter->slices = 0;
 	}
 
-	if (afu_np)
-		of_node_put(afu_np);
+	of_node_put(afu_np);
 	return 0;
 }
 
-- 
2.9.2

[toc] | [next] | [standalone]


#1447233 — Re: [PATCH] cxl: Delete an unnecessary check before the function call "of_node_put"

FromJulia Lawall <julia.lawall@lip6.fr>
Date2016-07-20 15:40 +0200
SubjectRe: [PATCH] cxl: Delete an unnecessary check before the function call "of_node_put"
Message-ID<rWZTc-21W-17@gated-at.bofh.it>
In reply to#1447227

On Wed, 20 Jul 2016, SF Markus Elfring wrote:

> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Wed, 20 Jul 2016 15:10:32 +0200
>
> The of_node_put() function tests whether its argument is NULL
> and then returns immediately.
> Thus the test around the call is not needed.
>
> This issue was detected by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  drivers/misc/cxl/of.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/misc/cxl/of.c b/drivers/misc/cxl/of.c
> index edc4583..333256a 100644
> --- a/drivers/misc/cxl/of.c
> +++ b/drivers/misc/cxl/of.c
> @@ -490,8 +490,7 @@ int cxl_of_probe(struct platform_device *pdev)
>  		adapter->slices = 0;
>  	}
>
> -	if (afu_np)
> -		of_node_put(afu_np);
> +	of_node_put(afu_np);
>  	return 0;
>  }

I don't think that the call should be there at all.  The loop only exits
when afu_np is NULL.  Furthermore, the loop should not be written as a for
loop, but rather with for_each_child_of_node.

julia

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web