diff options
author | Guenter Roeck <linux@roeck-us.net> | 2014-10-04 19:31:13 -0400 |
---|---|---|
committer | Sebastian Reichel <sre@kernel.org> | 2014-10-04 20:10:20 -0400 |
commit | 7881c64716f3a7d60b325ed0ad4d15f49b474a43 (patch) | |
tree | b4b811e483e4d5753cae813e9ca1e0f231aa6486 /drivers/power | |
parent | c8c5ebcc5e33a0ae65b6b1cba8d257d423f25da0 (diff) |
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: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
Diffstat (limited to 'drivers/power')
-rw-r--r-- | drivers/power/ab8500_fg.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/power/ab8500_fg.c b/drivers/power/ab8500_fg.c index 3cb4178e397c..217da4b2ca86 100644 --- a/drivers/power/ab8500_fg.c +++ b/drivers/power/ab8500_fg.c | |||
@@ -2969,7 +2969,7 @@ static struct device_attribute ab8505_fg_sysfs_psy_attrs[] = { | |||
2969 | 2969 | ||
2970 | static int ab8500_fg_sysfs_psy_create_attrs(struct device *dev) | 2970 | static int ab8500_fg_sysfs_psy_create_attrs(struct device *dev) |
2971 | { | 2971 | { |
2972 | unsigned int i, j; | 2972 | unsigned int i; |
2973 | struct power_supply *psy = dev_get_drvdata(dev); | 2973 | struct power_supply *psy = dev_get_drvdata(dev); |
2974 | struct ab8500_fg *di; | 2974 | struct ab8500_fg *di; |
2975 | 2975 | ||
@@ -2978,14 +2978,15 @@ static int ab8500_fg_sysfs_psy_create_attrs(struct device *dev) | |||
2978 | if (((is_ab8505(di->parent) || is_ab9540(di->parent)) && | 2978 | if (((is_ab8505(di->parent) || is_ab9540(di->parent)) && |
2979 | abx500_get_chip_id(dev->parent) >= AB8500_CUT2P0) | 2979 | abx500_get_chip_id(dev->parent) >= AB8500_CUT2P0) |
2980 | || is_ab8540(di->parent)) { | 2980 | || is_ab8540(di->parent)) { |
2981 | for (j = 0; j < ARRAY_SIZE(ab8505_fg_sysfs_psy_attrs); j++) | 2981 | for (i = 0; i < ARRAY_SIZE(ab8505_fg_sysfs_psy_attrs); i++) |
2982 | if (device_create_file(dev, &ab8505_fg_sysfs_psy_attrs[j])) | 2982 | if (device_create_file(dev, |
2983 | &ab8505_fg_sysfs_psy_attrs[i])) | ||
2983 | goto sysfs_psy_create_attrs_failed_ab8505; | 2984 | goto sysfs_psy_create_attrs_failed_ab8505; |
2984 | } | 2985 | } |
2985 | return 0; | 2986 | return 0; |
2986 | sysfs_psy_create_attrs_failed_ab8505: | 2987 | sysfs_psy_create_attrs_failed_ab8505: |
2987 | dev_err(dev, "Failed creating sysfs psy attrs for ab8505.\n"); | 2988 | dev_err(dev, "Failed creating sysfs psy attrs for ab8505.\n"); |
2988 | while (j--) | 2989 | while (i--) |
2989 | device_remove_file(dev, &ab8505_fg_sysfs_psy_attrs[i]); | 2990 | device_remove_file(dev, &ab8505_fg_sysfs_psy_attrs[i]); |
2990 | 2991 | ||
2991 | return -EIO; | 2992 | return -EIO; |