Commit 396df700 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'for-v5.19-rc' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply

Pull power supply fixes from Sebastian Reichel:

 - power-supply core temperature interpolation regression fix for
   incorrect boundaries

 - ab8500 needs to destroy its work queues in error paths

 - Fix old DT refcount leak in arm-versatile

* tag 'for-v5.19-rc' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply:
  power: supply: core: Fix boundary conditions in interpolation
  power/reset: arm-versatile: Fix refcount leak in versatile_reboot_probe
  power: supply: ab8500_fg: add missing destroy_workqueue in ab8500_fg_probe
parents 972a278f 093d27bb
...@@ -146,6 +146,7 @@ static int __init versatile_reboot_probe(void) ...@@ -146,6 +146,7 @@ static int __init versatile_reboot_probe(void)
versatile_reboot_type = (enum versatile_reboot)reboot_id->data; versatile_reboot_type = (enum versatile_reboot)reboot_id->data;
syscon_regmap = syscon_node_to_regmap(np); syscon_regmap = syscon_node_to_regmap(np);
of_node_put(np);
if (IS_ERR(syscon_regmap)) if (IS_ERR(syscon_regmap))
return PTR_ERR(syscon_regmap); return PTR_ERR(syscon_regmap);
......
...@@ -3148,6 +3148,7 @@ static int ab8500_fg_probe(struct platform_device *pdev) ...@@ -3148,6 +3148,7 @@ static int ab8500_fg_probe(struct platform_device *pdev)
ret = ab8500_fg_init_hw_registers(di); ret = ab8500_fg_init_hw_registers(di);
if (ret) { if (ret) {
dev_err(dev, "failed to initialize registers\n"); dev_err(dev, "failed to initialize registers\n");
destroy_workqueue(di->fg_wq);
return ret; return ret;
} }
...@@ -3159,6 +3160,7 @@ static int ab8500_fg_probe(struct platform_device *pdev) ...@@ -3159,6 +3160,7 @@ static int ab8500_fg_probe(struct platform_device *pdev)
di->fg_psy = devm_power_supply_register(dev, &ab8500_fg_desc, &psy_cfg); di->fg_psy = devm_power_supply_register(dev, &ab8500_fg_desc, &psy_cfg);
if (IS_ERR(di->fg_psy)) { if (IS_ERR(di->fg_psy)) {
dev_err(dev, "failed to register FG psy\n"); dev_err(dev, "failed to register FG psy\n");
destroy_workqueue(di->fg_wq);
return PTR_ERR(di->fg_psy); return PTR_ERR(di->fg_psy);
} }
...@@ -3174,8 +3176,10 @@ static int ab8500_fg_probe(struct platform_device *pdev) ...@@ -3174,8 +3176,10 @@ static int ab8500_fg_probe(struct platform_device *pdev)
/* Register primary interrupt handlers */ /* Register primary interrupt handlers */
for (i = 0; i < ARRAY_SIZE(ab8500_fg_irq); i++) { for (i = 0; i < ARRAY_SIZE(ab8500_fg_irq); i++) {
irq = platform_get_irq_byname(pdev, ab8500_fg_irq[i].name); irq = platform_get_irq_byname(pdev, ab8500_fg_irq[i].name);
if (irq < 0) if (irq < 0) {
destroy_workqueue(di->fg_wq);
return irq; return irq;
}
ret = devm_request_threaded_irq(dev, irq, NULL, ret = devm_request_threaded_irq(dev, irq, NULL,
ab8500_fg_irq[i].isr, ab8500_fg_irq[i].isr,
...@@ -3185,6 +3189,7 @@ static int ab8500_fg_probe(struct platform_device *pdev) ...@@ -3185,6 +3189,7 @@ static int ab8500_fg_probe(struct platform_device *pdev)
if (ret != 0) { if (ret != 0) {
dev_err(dev, "failed to request %s IRQ %d: %d\n", dev_err(dev, "failed to request %s IRQ %d: %d\n",
ab8500_fg_irq[i].name, irq, ret); ab8500_fg_irq[i].name, irq, ret);
destroy_workqueue(di->fg_wq);
return ret; return ret;
} }
dev_dbg(dev, "Requested %s IRQ %d: %d\n", dev_dbg(dev, "Requested %s IRQ %d: %d\n",
...@@ -3200,6 +3205,7 @@ static int ab8500_fg_probe(struct platform_device *pdev) ...@@ -3200,6 +3205,7 @@ static int ab8500_fg_probe(struct platform_device *pdev)
ret = ab8500_fg_sysfs_init(di); ret = ab8500_fg_sysfs_init(di);
if (ret) { if (ret) {
dev_err(dev, "failed to create sysfs entry\n"); dev_err(dev, "failed to create sysfs entry\n");
destroy_workqueue(di->fg_wq);
return ret; return ret;
} }
...@@ -3207,6 +3213,7 @@ static int ab8500_fg_probe(struct platform_device *pdev) ...@@ -3207,6 +3213,7 @@ static int ab8500_fg_probe(struct platform_device *pdev)
if (ret) { if (ret) {
dev_err(dev, "failed to create FG psy\n"); dev_err(dev, "failed to create FG psy\n");
ab8500_fg_sysfs_exit(di); ab8500_fg_sysfs_exit(di);
destroy_workqueue(di->fg_wq);
return ret; return ret;
} }
......
...@@ -846,17 +846,17 @@ int power_supply_temp2resist_simple(struct power_supply_resistance_temp_table *t ...@@ -846,17 +846,17 @@ int power_supply_temp2resist_simple(struct power_supply_resistance_temp_table *t
{ {
int i, high, low; int i, high, low;
/* Break loop at table_len - 1 because that is the highest index */ for (i = 0; i < table_len; i++)
for (i = 0; i < table_len - 1; i++)
if (temp > table[i].temp) if (temp > table[i].temp)
break; break;
/* The library function will deal with high == low */ /* The library function will deal with high == low */
if ((i == 0) || (i == (table_len - 1))) if (i == 0)
high = i; high = low = i;
else if (i == table_len)
high = low = i - 1;
else else
high = i - 1; high = (low = i) - 1;
low = i;
return fixp_linear_interpolate(table[low].temp, return fixp_linear_interpolate(table[low].temp,
table[low].resistance, table[low].resistance,
...@@ -958,17 +958,17 @@ int power_supply_ocv2cap_simple(struct power_supply_battery_ocv_table *table, ...@@ -958,17 +958,17 @@ int power_supply_ocv2cap_simple(struct power_supply_battery_ocv_table *table,
{ {
int i, high, low; int i, high, low;
/* Break loop at table_len - 1 because that is the highest index */ for (i = 0; i < table_len; i++)
for (i = 0; i < table_len - 1; i++)
if (ocv > table[i].ocv) if (ocv > table[i].ocv)
break; break;
/* The library function will deal with high == low */ /* The library function will deal with high == low */
if ((i == 0) || (i == (table_len - 1))) if (i == 0)
high = i - 1; high = low = i;
else if (i == table_len)
high = low = i - 1;
else else
high = i; /* i.e. i == 0 */ high = (low = i) - 1;
low = i;
return fixp_linear_interpolate(table[low].ocv, return fixp_linear_interpolate(table[low].ocv,
table[low].capacity, table[low].capacity,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment