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


Groups > linux.kernel > #1264109 > unrolled thread

[PATCH] bq2415x_charger: Delete unnecessary checks before the function call "of_node_put"

Started bySF Markus Elfring <elfring@users.sourceforge.net>
First post2015-11-06 17:00 +0100
Last post2015-11-06 17:20 +0100
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] bq2415x_charger: Delete unnecessary checks before the  function call "of_node_put" SF Markus Elfring <elfring@users.sourceforge.net> - 2015-11-06 17:00 +0100
    Re: [PATCH] bq2415x_charger: Delete unnecessary checks before the  function call "of_node_put" Pali Rohár <pali.rohar@gmail.com> - 2015-11-06 17:20 +0100

#1264109 — [PATCH] bq2415x_charger: Delete unnecessary checks before the function call "of_node_put"

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2015-11-06 17:00 +0100
Subject[PATCH] bq2415x_charger: Delete unnecessary checks before the function call "of_node_put"
Message-ID<qrRAK-6pR-13@gated-at.bofh.it>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 6 Nov 2015 16:48:46 +0100

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

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/power/bq2415x_charger.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/power/bq2415x_charger.c b/drivers/power/bq2415x_charger.c
index 4afd768..27e8953 100644
--- a/drivers/power/bq2415x_charger.c
+++ b/drivers/power/bq2415x_charger.c
@@ -1704,7 +1704,7 @@ error_4:
 error_3:
 	bq2415x_power_supply_exit(bq);
 error_2:
-	if (bq && bq->notify_node)
+	if (bq)
 		of_node_put(bq->notify_node);
 	kfree(name);
 error_1:
@@ -1724,9 +1724,7 @@ static int bq2415x_remove(struct i2c_client *client)
 	if (bq->nb.notifier_call)
 		power_supply_unreg_notifier(&bq->nb);
 
-	if (bq->notify_node)
-		of_node_put(bq->notify_node);
-
+	of_node_put(bq->notify_node);
 	bq2415x_sysfs_exit(bq);
 	bq2415x_power_supply_exit(bq);
 
-- 
2.6.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1264132

FromPali Rohár <pali.rohar@gmail.com>
Date2015-11-06 17:20 +0100
Message-ID<qrRU7-6M2-19@gated-at.bofh.it>
In reply to#1264109
On Friday 06 November 2015 16:56:33 SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Fri, 6 Nov 2015 16:48:46 +0100
> 
> The of_node_put() function tests whether its argument is NULL and then
> returns immediately. Thus the test around the calls is not needed.
> 
> This issue was detected by using the Coccinelle software.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>

Acked-by: Pali Rohár <pali.rohar@gmail.com>

-- 
Pali Rohár
pali.rohar@gmail.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web