linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] power: ab8500_fg: Fix build warning
@ 2014-10-04 23:31 Guenter Roeck
  2014-10-05  0:12 ` Sebastian Reichel
  0 siblings, 1 reply; 2+ messages in thread
From: Guenter Roeck @ 2014-10-04 23:31 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Dmitry Eremin-Solenikov, David Woodhouse, linux-pm, linux-kernel,
	Guenter Roeck

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>
---
 drivers/power/ab8500_fg.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/power/ab8500_fg.c b/drivers/power/ab8500_fg.c
index 3cb4178..217da4b 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[] = {
 
 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 ab8500_fg *di;
 
@@ -2978,14 +2978,15 @@ static int ab8500_fg_sysfs_psy_create_attrs(struct device *dev)
 	if (((is_ab8505(di->parent) || is_ab9540(di->parent)) &&
 	     abx500_get_chip_id(dev->parent) >= AB8500_CUT2P0)
 	    || is_ab8540(di->parent)) {
-		for (j = 0; j < ARRAY_SIZE(ab8505_fg_sysfs_psy_attrs); j++)
-			if (device_create_file(dev, &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[i]))
 				goto sysfs_psy_create_attrs_failed_ab8505;
 	}
 	return 0;
 sysfs_psy_create_attrs_failed_ab8505:
 	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]);
 
 	return -EIO;
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] power: ab8500_fg: Fix build warning
  2014-10-04 23:31 [PATCH] power: ab8500_fg: Fix build warning Guenter Roeck
@ 2014-10-05  0:12 ` Sebastian Reichel
  0 siblings, 0 replies; 2+ messages in thread
From: Sebastian Reichel @ 2014-10-05  0:12 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Dmitry Eremin-Solenikov, David Woodhouse, linux-pm, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 536 bytes --]

Hi,

On Sat, Oct 04, 2014 at 04:31:13PM -0700, Guenter Roeck wrote:
> 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>

Thanks, pushed:

http://git.infradead.org/battery-2.6.git/commit/7881c64716f3a7d60b325ed0ad4d15f49b474a43

-- Sebastian

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-10-05  0:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-04 23:31 [PATCH] power: ab8500_fg: Fix build warning Guenter Roeck
2014-10-05  0:12 ` Sebastian Reichel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).