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>

authored by Andres Salomon and committed by Anton Vorontsov 839dc9f1 8efe4440

+2 -4
+2 -4
drivers/power/power_supply_sysfs.c
··· 155 &power_supply_attrs[psy->properties[j]]); 156 statics_failed: 157 while (i--) 158 - device_remove_file(psy->dev, 159 - &power_supply_static_attrs[psy->properties[i]]); 160 succeed: 161 return rc; 162 } ··· 165 int i; 166 167 for (i = 0; i < ARRAY_SIZE(power_supply_static_attrs); i++) 168 - device_remove_file(psy->dev, 169 - &power_supply_static_attrs[i]); 170 171 for (i = 0; i < psy->num_properties; i++) 172 device_remove_file(psy->dev,
··· 155 &power_supply_attrs[psy->properties[j]]); 156 statics_failed: 157 while (i--) 158 + device_remove_file(psy->dev, &power_supply_static_attrs[i]); 159 succeed: 160 return rc; 161 } ··· 166 int i; 167 168 for (i = 0; i < ARRAY_SIZE(power_supply_static_attrs); i++) 169 + device_remove_file(psy->dev, &power_supply_static_attrs[i]); 170 171 for (i = 0; i < psy->num_properties; i++) 172 device_remove_file(psy->dev,