bq2415x_charger: Fix null pointer dereference

Commit b68c316143 (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: b68c316143 ("bq2415x_charger: Allow to load and use driver even if notify device is not registered yet")
Reported-by: Dan Carpenter <[email protected]>
Signed-off-by: Pali Rohár <[email protected]>
Signed-off-by: Sebastian Reichel <[email protected]>
This commit is contained in:
Pali Rohár 2015-09-21 16:58:20 +02:00 • committed by Sebastian Reichel
commit 28153a31b8

View file

@ -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: