mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH]Fix warning in device_add_attrs
@ 2007-02-06 20:05 Jean Delvare
  0 siblings, 0 replies; only message in thread
From: Jean Delvare @ 2007-02-06 20:05 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: LKML

Fix the following warning which I see with gcc 3.2:
drivers/base/core.c: In function `device_add_attrs':
drivers/base/core.c:251: warning: `i' might be used uninitialized in this function
It's a false positive, but it can be worked around easily, and the new
code makes rather more sense.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
---
 drivers/base/core.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- linux-2.6.20.orig/drivers/base/core.c	2007-02-06 09:25:49.000000000 +0100
+++ linux-2.6.20/drivers/base/core.c	2007-02-06 20:40:46.000000000 +0100
@@ -259,10 +259,10 @@ static int device_add_attrs(struct devic
 			if (error)
 				break;
 		}
+		if (error)
+			while (--i >= 0)
+				device_remove_file(dev, &class->dev_attrs[i]);
 	}
-	if (error)
-		while (--i >= 0)
-			device_remove_file(dev, &class->dev_attrs[i]);
 	return error;
 }
 


-- 
Jean Delvare

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-02-06 20:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-06 20:05 [PATCH]Fix warning in device_add_attrs Jean Delvare

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®