diff options
author | Andres Salomon | 2007-12-12 20:12:59 +0100 |
---|---|---|
committer | Anton Vorontsov | 2008-02-02 00:42:59 +0100 |
commit | 839dc9f105c0d856f9a0be48fb3bd0982ff5df5b (patch) | |
tree | a16cad00b33e82d3a11b186806eb9590b69ddaca /drivers/power | |
parent | power: remove POWER_SUPPLY_PROP_CAPACITY_LEVEL (diff) | |
download | kernel-qcow2-linux-839dc9f105c0d856f9a0be48fb3bd0982ff5df5b.tar.gz kernel-qcow2-linux-839dc9f105c0d856f9a0be48fb3bd0982ff5df5b.tar.xz kernel-qcow2-linux-839dc9f105c0d856f9a0be48fb3bd0982ff5df5b.zip |
power: fix incorrect unregistration in power_supply_create_attrs error path
In power_supply_create_attrs(), we create static attributes as referenced
by power_supply_static_attrs[i]. After that, if we fail, we unregister
via power_supply_static_attrs[psy->properties[i]]. This is incorrect, as
psy->properties has absolutely no bearing on static attribs. This patch
fixes it to unregister the correct attrib.
Another line which was unnecessarily line wrapped is also unwrapped.
Signed-off-by: Andres Salomon <dilinger@debian.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Diffstat (limited to 'drivers/power')
-rw-r--r-- | drivers/power/power_supply_sysfs.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/power/power_supply_sysfs.c b/drivers/power/power_supply_sysfs.c index 7a2163fa61c3..bab591ba785a 100644 --- a/drivers/power/power_supply_sysfs.c +++ b/drivers/power/power_supply_sysfs.c @@ -155,8 +155,7 @@ dynamics_failed: &power_supply_attrs[psy->properties[j]]); statics_failed: while (i--) - device_remove_file(psy->dev, - &power_supply_static_attrs[psy->properties[i]]); + device_remove_file(psy->dev, &power_supply_static_attrs[i]); succeed: return rc; } @@ -166,8 +165,7 @@ void power_supply_remove_attrs(struct power_supply *psy) int i; for (i = 0; i < ARRAY_SIZE(power_supply_static_attrs); i++) - device_remove_file(psy->dev, - &power_supply_static_attrs[i]); + device_remove_file(psy->dev, &power_supply_static_attrs[i]); for (i = 0; i < psy->num_properties; i++) device_remove_file(psy->dev, |