Skip to content

Commit

Permalink
power: bq2415x_charger: Delete unnecessary checks before the function…
Browse files Browse the repository at this point in the history
… call "of_node_put"

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 <[email protected]>
Acked-by: Pali Rohár <[email protected]>
Signed-off-by: Sebastian Reichel <[email protected]>
  • Loading branch information
elfring authored and sre committed Dec 5, 2015
1 parent 31ade3b commit b7e16ec
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions drivers/power/bq2415x_charger.c
Original file line number Diff line number Diff line change
Expand Up @@ -1704,7 +1704,7 @@ static int bq2415x_probe(struct i2c_client *client,
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:
Expand All @@ -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);

Expand Down

0 comments on commit b7e16ec

Please sign in to comment.