From: Pali Rohár Date: Mon, 21 Sep 2015 14:58:20 +0000 (+0200) Subject: bq2415x_charger: Fix null pointer dereference X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=28153a31b8b6c44e4f1e24dafce2f1b22cec427b;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git bq2415x_charger: Fix null pointer dereference Commit b68c3161430a (bq2415x_charger: Allow to load and use driver even if notify device is not registered yet) introduced null pointer dereference in case bq is NULL. This patch fixes it. Fixes: b68c3161430a ("bq2415x_charger: Allow to load and use driver even if notify device is not registered yet") Reported-by: Dan Carpenter Signed-off-by: Pali Rohár Signed-off-by: Sebastian Reichel --- diff --git a/drivers/power/bq2415x_charger.c b/drivers/power/bq2415x_charger.c index ec212b5be755..4afd76848bce 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->notify_node) + if (bq && bq->notify_node) of_node_put(bq->notify_node); kfree(name); error_1: