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


Groups > linux.kernel > #1449091 > unrolled thread

[PATCH] Input-rmi_bus: Delete an unnecessary check before the function call "of_node_put"

Started bySF Markus Elfring <elfring@users.sourceforge.net>
First post2016-07-24 09:40 +0200
Last post2016-07-25 20: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] Input-rmi_bus: Delete an unnecessary check before the  function call "of_node_put" SF Markus Elfring <elfring@users.sourceforge.net> - 2016-07-24 09:40 +0200
    Re: [PATCH] Input-rmi_bus: Delete an unnecessary check before the  function call "of_node_put" Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2016-07-25 20:40 +0200

#1449091 — [PATCH] Input-rmi_bus: Delete an unnecessary check before the function call "of_node_put"

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2016-07-24 09:40 +0200
Subject[PATCH] Input-rmi_bus: Delete an unnecessary check before the function call "of_node_put"
Message-ID<rYmb0-57g-7@gated-at.bofh.it>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 24 Jul 2016 07:37:23 +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/input/rmi4/rmi_bus.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/input/rmi4/rmi_bus.c b/drivers/input/rmi4/rmi_bus.c
index 253df96..a735806 100644
--- a/drivers/input/rmi4/rmi_bus.c
+++ b/drivers/input/rmi4/rmi_bus.c
@@ -232,10 +232,7 @@ err_put_device:
 void rmi_unregister_function(struct rmi_function *fn)
 {
 	device_del(&fn->dev);
-
-	if (fn->dev.of_node)
-		of_node_put(fn->dev.of_node);
-
+	of_node_put(fn->dev.of_node);
 	put_device(&fn->dev);
 }
 
-- 
2.9.2

[toc] | [next] | [standalone]


#1449735

FromDmitry Torokhov <dmitry.torokhov@gmail.com>
Date2016-07-25 20:40 +0200
Message-ID<rYSXg-7Yy-35@gated-at.bofh.it>
In reply to#1449091
On Sun, Jul 24, 2016 at 09:35:56AM +0200, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 24 Jul 2016 07:37:23 +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>

Applied, thank you.

> ---
>  drivers/input/rmi4/rmi_bus.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/input/rmi4/rmi_bus.c b/drivers/input/rmi4/rmi_bus.c
> index 253df96..a735806 100644
> --- a/drivers/input/rmi4/rmi_bus.c
> +++ b/drivers/input/rmi4/rmi_bus.c
> @@ -232,10 +232,7 @@ err_put_device:
>  void rmi_unregister_function(struct rmi_function *fn)
>  {
>  	device_del(&fn->dev);
> -
> -	if (fn->dev.of_node)
> -		of_node_put(fn->dev.of_node);
> -
> +	of_node_put(fn->dev.of_node);
>  	put_device(&fn->dev);
>  }
>  
> -- 
> 2.9.2
> 

-- 
Dmitry

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web