Commit d7b5c942 authored by Linus Torvalds's avatar Linus Torvalds

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

Pull power supply fixes from Sebastian Reichel:

 - rk817: Fix compiler warning

 - cros_usbpd-charger: Fix excessive error printing

 - axp288_fuel_gauge: handle platform_get_irq error

 - bq24190 and da9150: Fix race condition in remove path

* tag 'for-v6.3-rc' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply:
  power: supply: da9150: Fix use after free bug in da9150_charger_remove due to race condition
  power: supply: bq24190: Fix use after free bug in bq24190_remove due to race condition
  power: supply: axp288_fuel_gauge: Added check for negative values
  power: supply: cros_usbpd: reclassify "default case!" as debug
  power: supply: rk817: Fix unsigned comparison with less than zero
parents 37154c19 06615d11
...@@ -724,6 +724,8 @@ static int axp288_fuel_gauge_probe(struct platform_device *pdev) ...@@ -724,6 +724,8 @@ static int axp288_fuel_gauge_probe(struct platform_device *pdev)
for (i = 0; i < AXP288_FG_INTR_NUM; i++) { for (i = 0; i < AXP288_FG_INTR_NUM; i++) {
pirq = platform_get_irq(pdev, i); pirq = platform_get_irq(pdev, i);
if (pirq < 0)
continue;
ret = regmap_irq_get_virq(axp20x->regmap_irqc, pirq); ret = regmap_irq_get_virq(axp20x->regmap_irqc, pirq);
if (ret < 0) if (ret < 0)
return dev_err_probe(dev, ret, "getting vIRQ %d\n", pirq); return dev_err_probe(dev, ret, "getting vIRQ %d\n", pirq);
......
...@@ -1906,6 +1906,7 @@ static void bq24190_remove(struct i2c_client *client) ...@@ -1906,6 +1906,7 @@ static void bq24190_remove(struct i2c_client *client)
struct bq24190_dev_info *bdi = i2c_get_clientdata(client); struct bq24190_dev_info *bdi = i2c_get_clientdata(client);
int error; int error;
cancel_delayed_work_sync(&bdi->input_current_limit_work);
error = pm_runtime_resume_and_get(bdi->dev); error = pm_runtime_resume_and_get(bdi->dev);
if (error < 0) if (error < 0)
dev_warn(bdi->dev, "pm_runtime_get failed: %i\n", error); dev_warn(bdi->dev, "pm_runtime_get failed: %i\n", error);
......
...@@ -276,7 +276,7 @@ static int cros_usbpd_charger_get_power_info(struct port_data *port) ...@@ -276,7 +276,7 @@ static int cros_usbpd_charger_get_power_info(struct port_data *port)
port->psy_current_max = 0; port->psy_current_max = 0;
break; break;
default: default:
dev_err(dev, "Port %d: default case!\n", port->port_number); dev_dbg(dev, "Port %d: default case!\n", port->port_number);
port->psy_usb_type = POWER_SUPPLY_USB_TYPE_SDP; port->psy_usb_type = POWER_SUPPLY_USB_TYPE_SDP;
} }
......
...@@ -657,6 +657,7 @@ static int da9150_charger_remove(struct platform_device *pdev) ...@@ -657,6 +657,7 @@ static int da9150_charger_remove(struct platform_device *pdev)
if (!IS_ERR_OR_NULL(charger->usb_phy)) if (!IS_ERR_OR_NULL(charger->usb_phy))
usb_unregister_notifier(charger->usb_phy, &charger->otg_nb); usb_unregister_notifier(charger->usb_phy, &charger->otg_nb);
cancel_work_sync(&charger->otg_work);
power_supply_unregister(charger->battery); power_supply_unregister(charger->battery);
power_supply_unregister(charger->usb); power_supply_unregister(charger->usb);
......
...@@ -785,8 +785,6 @@ rk817_read_or_set_full_charge_on_boot(struct rk817_charger *charger, ...@@ -785,8 +785,6 @@ rk817_read_or_set_full_charge_on_boot(struct rk817_charger *charger,
regmap_bulk_read(rk808->regmap, RK817_GAS_GAUGE_Q_PRES_H3, regmap_bulk_read(rk808->regmap, RK817_GAS_GAUGE_Q_PRES_H3,
bulk_reg, 4); bulk_reg, 4);
tmp = get_unaligned_be32(bulk_reg); tmp = get_unaligned_be32(bulk_reg);
if (tmp < 0)
tmp = 0;
boot_charge_mah = ADC_TO_CHARGE_UAH(tmp, boot_charge_mah = ADC_TO_CHARGE_UAH(tmp,
charger->res_div) / 1000; charger->res_div) / 1000;
/* /*
...@@ -825,8 +823,6 @@ rk817_read_or_set_full_charge_on_boot(struct rk817_charger *charger, ...@@ -825,8 +823,6 @@ rk817_read_or_set_full_charge_on_boot(struct rk817_charger *charger,
regmap_bulk_read(rk808->regmap, RK817_GAS_GAUGE_Q_PRES_H3, regmap_bulk_read(rk808->regmap, RK817_GAS_GAUGE_Q_PRES_H3,
bulk_reg, 4); bulk_reg, 4);
tmp = get_unaligned_be32(bulk_reg); tmp = get_unaligned_be32(bulk_reg);
if (tmp < 0)
tmp = 0;
boot_charge_mah = ADC_TO_CHARGE_UAH(tmp, charger->res_div) / 1000; boot_charge_mah = ADC_TO_CHARGE_UAH(tmp, charger->res_div) / 1000;
regmap_bulk_read(rk808->regmap, RK817_GAS_GAUGE_OCV_VOL_H, regmap_bulk_read(rk808->regmap, RK817_GAS_GAUGE_OCV_VOL_H,
bulk_reg, 2); bulk_reg, 2);
......
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