Commit 7881c647 authored by Guenter Roeck's avatar Guenter Roeck Committed by Sebastian Reichel

power: ab8500_fg: Fix build warning

Fix

drivers/power/ab8500_fg.c: In function 'ab8500_fg_probe':
drivers/power/ab8500_fg.c:2989:27:
		warning: 'i' may be used uninitialized in this function
drivers/power/ab8500_fg.c:2972:15: note: 'i' was declared here

which actually points to a real bug.
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
Signed-off-by: default avatarSebastian Reichel <sre@kernel.org>
parent c8c5ebcc
...@@ -2969,7 +2969,7 @@ static struct device_attribute ab8505_fg_sysfs_psy_attrs[] = { ...@@ -2969,7 +2969,7 @@ static struct device_attribute ab8505_fg_sysfs_psy_attrs[] = {
static int ab8500_fg_sysfs_psy_create_attrs(struct device *dev) static int ab8500_fg_sysfs_psy_create_attrs(struct device *dev)
{ {
unsigned int i, j; unsigned int i;
struct power_supply *psy = dev_get_drvdata(dev); struct power_supply *psy = dev_get_drvdata(dev);
struct ab8500_fg *di; struct ab8500_fg *di;
...@@ -2978,14 +2978,15 @@ static int ab8500_fg_sysfs_psy_create_attrs(struct device *dev) ...@@ -2978,14 +2978,15 @@ static int ab8500_fg_sysfs_psy_create_attrs(struct device *dev)
if (((is_ab8505(di->parent) || is_ab9540(di->parent)) && if (((is_ab8505(di->parent) || is_ab9540(di->parent)) &&
abx500_get_chip_id(dev->parent) >= AB8500_CUT2P0) abx500_get_chip_id(dev->parent) >= AB8500_CUT2P0)
|| is_ab8540(di->parent)) { || is_ab8540(di->parent)) {
for (j = 0; j < ARRAY_SIZE(ab8505_fg_sysfs_psy_attrs); j++) for (i = 0; i < ARRAY_SIZE(ab8505_fg_sysfs_psy_attrs); i++)
if (device_create_file(dev, &ab8505_fg_sysfs_psy_attrs[j])) if (device_create_file(dev,
&ab8505_fg_sysfs_psy_attrs[i]))
goto sysfs_psy_create_attrs_failed_ab8505; goto sysfs_psy_create_attrs_failed_ab8505;
} }
return 0; return 0;
sysfs_psy_create_attrs_failed_ab8505: sysfs_psy_create_attrs_failed_ab8505:
dev_err(dev, "Failed creating sysfs psy attrs for ab8505.\n"); dev_err(dev, "Failed creating sysfs psy attrs for ab8505.\n");
while (j--) while (i--)
device_remove_file(dev, &ab8505_fg_sysfs_psy_attrs[i]); device_remove_file(dev, &ab8505_fg_sysfs_psy_attrs[i]);
return -EIO; return -EIO;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment