From: Markus Elfring Date: Fri, 6 Nov 2015 15:48:46 +0000 (+0100) Subject: power: bq2415x_charger: Delete unnecessary checks before the function call "of_node_put" X-Git-Tag: v4.5-rc1~106^2~12 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=b7e16ec6e3d2ea0b62cf93a0e849db55f403a871;p=linux.git power: bq2415x_charger: Delete unnecessary checks before the function 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 Acked-by: Pali Rohár Signed-off-by: Sebastian Reichel --- diff --git a/drivers/power/bq2415x_charger.c b/drivers/power/bq2415x_charger.c index 4afd76848bce..27e89536689a 100644 --- a/drivers/power/bq2415x_charger.c +++ b/drivers/power/bq2415x_charger.c @@ -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: @@ -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);