aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/sbs.c
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@redhat.com>2007-11-17 16:32:31 -0500
committerLen Brown <len.brown@intel.com>2007-11-18 17:24:01 -0500
commit037cbc63fd83162a8ee0c69680207ce4609adbea (patch)
tree8a059dc10281006bfd18abb2cc6aa78eed6e53d6 /drivers/acpi/sbs.c
parent4c41d3ad6544f1c9aec37c441af04f5d0ad3a731 (diff)
ACPI: SBS: Fix retval warning
drivers/acpi/sbs.c: In function acpi_battery_add: drivers/acpi/sbs.c:811: warning: ignoring return value of device_create_file, declared with attribute warn_unused_result Additional cleanups: * use struct acpi_battery in acpi_battery_remove() to clean up function calls, just like acpi_battery_add() already does. * put braces around unregister call, as it depends on dev being not NULL. * remove unneeded braces Signed-off-by: Jeff Garzik <jgarzik@redhat.com> Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/sbs.c')
-rw-r--r--drivers/acpi/sbs.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c
index 90fd09c65f95..73c1ba314299 100644
--- a/drivers/acpi/sbs.c
+++ b/drivers/acpi/sbs.c
@@ -113,6 +113,7 @@ struct acpi_battery {
113 u16 spec; 113 u16 spec;
114 u8 id; 114 u8 id;
115 u8 present:1; 115 u8 present:1;
116 u8 have_sysfs_alarm:1;
116}; 117};
117 118
118#define to_acpi_battery(x) container_of(x, struct acpi_battery, bat); 119#define to_acpi_battery(x) container_of(x, struct acpi_battery, bat);
@@ -808,7 +809,13 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id)
808 } 809 }
809 battery->bat.get_property = acpi_sbs_battery_get_property; 810 battery->bat.get_property = acpi_sbs_battery_get_property;
810 result = power_supply_register(&sbs->device->dev, &battery->bat); 811 result = power_supply_register(&sbs->device->dev, &battery->bat);
811 device_create_file(battery->bat.dev, &alarm_attr); 812 if (result)
813 goto end;
814 result = device_create_file(battery->bat.dev, &alarm_attr);
815 if (result)
816 goto end;
817 battery->have_sysfs_alarm = 1;
818 end:
812 printk(KERN_INFO PREFIX "%s [%s]: Battery Slot [%s] (battery %s)\n", 819 printk(KERN_INFO PREFIX "%s [%s]: Battery Slot [%s] (battery %s)\n",
813 ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device), 820 ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device),
814 battery->name, sbs->battery->present ? "present" : "absent"); 821 battery->name, sbs->battery->present ? "present" : "absent");
@@ -817,14 +824,16 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id)
817 824
818static void acpi_battery_remove(struct acpi_sbs *sbs, int id) 825static void acpi_battery_remove(struct acpi_sbs *sbs, int id)
819{ 826{
820 if (sbs->battery[id].bat.dev) 827 struct acpi_battery *battery = &sbs->battery[id];
821 device_remove_file(sbs->battery[id].bat.dev, &alarm_attr); 828
822 power_supply_unregister(&sbs->battery[id].bat); 829 if (battery->bat.dev) {
823#ifdef CONFIG_ACPI_PROCFS 830 if (battery->have_sysfs_alarm)
824 if (sbs->battery[id].proc_entry) { 831 device_remove_file(battery->bat.dev, &alarm_attr);
825 acpi_sbs_remove_fs(&(sbs->battery[id].proc_entry), 832 power_supply_unregister(&battery->bat);
826 acpi_battery_dir);
827 } 833 }
834#ifdef CONFIG_ACPI_PROCFS
835 if (battery->proc_entry)
836 acpi_sbs_remove_fs(&battery->proc_entry, acpi_battery_dir);
828#endif 837#endif
829} 838}
830 839