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 155 &power_supply_attrs[psy->properties[j]]); 156 156 statics_failed: 157 157 while (i--) 158 - device_remove_file(psy->dev, 159 - &power_supply_static_attrs[psy->properties[i]]); 158 + device_remove_file(psy->dev, &power_supply_static_attrs[i]); 160 159 succeed: 161 160 return rc; 162 161 } ··· 165 166 int i; 166 167 167 168 for (i = 0; i < ARRAY_SIZE(power_supply_static_attrs); i++) 168 - device_remove_file(psy->dev, 169 - &power_supply_static_attrs[i]); 169 + device_remove_file(psy->dev, &power_supply_static_attrs[i]); 170 170 171 171 for (i = 0; i < psy->num_properties; i++) 172 172 device_remove_file(psy->dev,