|
@@ -986,21 +986,27 @@ static int acpi_battery_add(struct acpi_device *device)
|
|
#ifdef CONFIG_ACPI_PROCFS_POWER
|
|
#ifdef CONFIG_ACPI_PROCFS_POWER
|
|
result = acpi_battery_add_fs(device);
|
|
result = acpi_battery_add_fs(device);
|
|
#endif
|
|
#endif
|
|
- if (!result) {
|
|
|
|
- printk(KERN_INFO PREFIX "%s Slot [%s] (battery %s)\n",
|
|
|
|
- ACPI_BATTERY_DEVICE_NAME, acpi_device_bid(device),
|
|
|
|
- device->status.battery_present ? "present" : "absent");
|
|
|
|
- } else {
|
|
|
|
|
|
+ if (result) {
|
|
#ifdef CONFIG_ACPI_PROCFS_POWER
|
|
#ifdef CONFIG_ACPI_PROCFS_POWER
|
|
acpi_battery_remove_fs(device);
|
|
acpi_battery_remove_fs(device);
|
|
#endif
|
|
#endif
|
|
- kfree(battery);
|
|
|
|
|
|
+ goto fail;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ printk(KERN_INFO PREFIX "%s Slot [%s] (battery %s)\n",
|
|
|
|
+ ACPI_BATTERY_DEVICE_NAME, acpi_device_bid(device),
|
|
|
|
+ device->status.battery_present ? "present" : "absent");
|
|
|
|
+
|
|
battery->pm_nb.notifier_call = battery_notify;
|
|
battery->pm_nb.notifier_call = battery_notify;
|
|
register_pm_notifier(&battery->pm_nb);
|
|
register_pm_notifier(&battery->pm_nb);
|
|
|
|
|
|
return result;
|
|
return result;
|
|
|
|
+
|
|
|
|
+fail:
|
|
|
|
+ sysfs_remove_battery(battery);
|
|
|
|
+ mutex_destroy(&battery->lock);
|
|
|
|
+ kfree(battery);
|
|
|
|
+ return result;
|
|
}
|
|
}
|
|
|
|
|
|
static int acpi_battery_remove(struct acpi_device *device, int type)
|
|
static int acpi_battery_remove(struct acpi_device *device, int type)
|