ACPI: Battery: remove cycle from battery removal. From: <> get_property() should not call battery_update() on absent battery to avoid cycle and oops. Signed-off-by: Alexey Starikovskiy --- drivers/acpi/battery.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index c2ce0ad..50cdf6f 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c @@ -140,10 +140,11 @@ static int acpi_battery_get_property(struct power_supply *psy, { struct acpi_battery *battery = to_acpi_battery(psy); - if ((!acpi_battery_present(battery)) && - psp != POWER_SUPPLY_PROP_PRESENT) + if (acpi_battery_present(battery)) { + /* run battery update only if it is present */ + acpi_battery_update(battery); + } else if (psp != POWER_SUPPLY_PROP_PRESENT) return -ENODEV; - acpi_battery_update(battery); switch (psp) { case POWER_SUPPLY_PROP_STATUS: if (battery->state & 0x01)