Skip to content

Commit

Permalink
ACPI / Battery: propagate sysfs error in acpi_battery_add()
Browse files Browse the repository at this point in the history
Make sure the error return from sysfs_add_battery() is checked and
propagated out from acpi_battery_add().

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Len Brown <len.brown@intel.com>
  • Loading branch information
Stefan Hajnoczi authored and Len Brown committed Jul 16, 2011
1 parent e80bba4 commit eb03cb0
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions drivers/acpi/battery.c
Original file line number Diff line number Diff line change
Expand Up @@ -630,8 +630,11 @@ static int acpi_battery_update(struct acpi_battery *battery)
return result;
acpi_battery_init_alarm(battery);
}
if (!battery->bat.dev)
sysfs_add_battery(battery);
if (!battery->bat.dev) {
result = sysfs_add_battery(battery);
if (result)
return result;
}
result = acpi_battery_get_state(battery);
acpi_battery_quirks(battery);
return result;
Expand Down Expand Up @@ -982,7 +985,9 @@ static int acpi_battery_add(struct acpi_device *device)
if (ACPI_SUCCESS(acpi_get_handle(battery->device->handle,
"_BIX", &handle)))
set_bit(ACPI_BATTERY_XINFO_PRESENT, &battery->flags);
acpi_battery_update(battery);
result = acpi_battery_update(battery);
if (result)
goto fail;
#ifdef CONFIG_ACPI_PROCFS_POWER
result = acpi_battery_add_fs(device);
#endif
Expand Down

0 comments on commit eb03cb0

Please sign in to comment.