diff options
Diffstat (limited to 'drivers/power/supply/power_supply_core.c')
-rw-r--r-- | drivers/power/supply/power_supply_core.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c index 02b37fe6061c..ccbad435ed12 100644 --- a/drivers/power/supply/power_supply_core.c +++ b/drivers/power/supply/power_supply_core.c @@ -733,7 +733,7 @@ EXPORT_SYMBOL_GPL(power_supply_put_battery_info); * percent * @table: Pointer to battery resistance temperature table * @table_len: The table length - * @ocv: Current temperature + * @temp: Current temperature * * This helper function is used to look up battery internal resistance percent * according to current temperature value from the resistance temperature table, @@ -939,7 +939,7 @@ static struct thermal_zone_device_ops psy_tzd_ops = { static int psy_register_thermal(struct power_supply *psy) { - int i; + int i, ret; if (psy->desc->no_thermal) return 0; @@ -949,7 +949,12 @@ static int psy_register_thermal(struct power_supply *psy) if (psy->desc->properties[i] == POWER_SUPPLY_PROP_TEMP) { psy->tzd = thermal_zone_device_register(psy->desc->name, 0, 0, psy, &psy_tzd_ops, NULL, 0, 0); - return PTR_ERR_OR_ZERO(psy->tzd); + if (IS_ERR(psy->tzd)) + return PTR_ERR(psy->tzd); + ret = thermal_zone_device_enable(psy->tzd); + if (ret) + thermal_zone_device_unregister(psy->tzd); + return ret; } } return 0; |