Skip to content

Commit

Permalink
power_supply: 88pm860x_charger: do not pass NULL to power_supply_put
Browse files Browse the repository at this point in the history
In the case where power_supply_get_by_name returns NULL the current
error return path calls power_supply_put with a NULL psy which will
cause a null pointer dereference.  Avoid this with an immediate
return.

Signed-off-by: Colin Ian King <[email protected]>
Signed-off-by: Sebastian Reichel <[email protected]>
  • Loading branch information
Colin Ian King authored and sre committed Mar 3, 2016
1 parent 7546453 commit 9761dca
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/power/88pm860x_charger.c
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ static irqreturn_t pm860x_temp_handler(int irq, void *data)

psy = power_supply_get_by_name(pm860x_supplied_to[0]);
if (!psy)
goto out;
return IRQ_HANDLED;
ret = power_supply_get_property(psy, POWER_SUPPLY_PROP_TEMP, &temp);
if (ret)
goto out;
Expand Down

0 comments on commit 9761dca

Please sign in to comment.