]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
power: fix incorrect unregistration in power_supply_create_attrs error path
authorAndres Salomon <dilinger@queued.net>
Wed, 12 Dec 2007 19:12:59 +0000 (14:12 -0500)
committerAnton Vorontsov <cbouatmailru@gmail.com>
Fri, 1 Feb 2008 23:42:59 +0000 (02:42 +0300)
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>
drivers/power/power_supply_sysfs.c

index 7a2163fa61c3591d9b9c97420997bb4142bd3404..bab591ba785a0a492e98b4b3ecb95c29ede60261 100644 (file)
@@ -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,