power_supply: 88pm860x_charger: do not pass NULL to power_supply_put
authorColin Ian King <colin.king@canonical.com>
Sun, 28 Feb 2016 19:57:58 +0000 (19:57 +0000)
committerSebastian Reichel <sre@kernel.org>
Thu, 3 Mar 2016 14:07:22 +0000 (15:07 +0100)
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 <colin.king@canonical.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
drivers/power/88pm860x_charger.c

index 297e72dc70e603aede8caa31d6f8d3cec22e8a61..2b82e44d9027292c28a176862e9d51f4737532f2 100644 (file)
@@ -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;