diff options
| author | Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> | 2011-07-12 04:03:29 -0400 |
|---|---|---|
| committer | Len Brown <len.brown@intel.com> | 2011-07-16 18:57:24 -0400 |
| commit | eb03cb02b74df6dd0b653d5f6d976f16a434dfaf (patch) | |
| tree | 0df6bbc6e0013153a9f914d50ac8e9a93ad154ac | |
| parent | e80bba4b5108c6479379740201b0a5d9da5ffbac (diff) | |
ACPI / Battery: propagate sysfs error in acpi_battery_add()
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>
| -rw-r--r-- | drivers/acpi/battery.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index c771768f57c8..ffce2f06dd8d 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c | |||
| @@ -630,8 +630,11 @@ static int acpi_battery_update(struct acpi_battery *battery) | |||
| 630 | return result; | 630 | return result; |
| 631 | acpi_battery_init_alarm(battery); | 631 | acpi_battery_init_alarm(battery); |
| 632 | } | 632 | } |
| 633 | if (!battery->bat.dev) | 633 | if (!battery->bat.dev) { |
| 634 | sysfs_add_battery(battery); | 634 | result = sysfs_add_battery(battery); |
| 635 | if (result) | ||
| 636 | return result; | ||
| 637 | } | ||
| 635 | result = acpi_battery_get_state(battery); | 638 | result = acpi_battery_get_state(battery); |
| 636 | acpi_battery_quirks(battery); | 639 | acpi_battery_quirks(battery); |
| 637 | return result; | 640 | return result; |
| @@ -982,7 +985,9 @@ static int acpi_battery_add(struct acpi_device *device) | |||
| 982 | if (ACPI_SUCCESS(acpi_get_handle(battery->device->handle, | 985 | if (ACPI_SUCCESS(acpi_get_handle(battery->device->handle, |
| 983 | "_BIX", &handle))) | 986 | "_BIX", &handle))) |
| 984 | set_bit(ACPI_BATTERY_XINFO_PRESENT, &battery->flags); | 987 | set_bit(ACPI_BATTERY_XINFO_PRESENT, &battery->flags); |
| 985 | acpi_battery_update(battery); | 988 | result = acpi_battery_update(battery); |
| 989 | if (result) | ||
| 990 | goto fail; | ||
| 986 | #ifdef CONFIG_ACPI_PROCFS_POWER | 991 | #ifdef CONFIG_ACPI_PROCFS_POWER |
| 987 | result = acpi_battery_add_fs(device); | 992 | result = acpi_battery_add_fs(device); |
| 988 | #endif | 993 | #endif |
