From: Jean Delvare <khali@linux-fr.org>
To: Greg Kroah-Hartman <gregkh@suse.de>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH]Fix warning in device_add_attrs
Date: Tue, 6 Feb 2007 21:05:57 +0100 [thread overview]
Message-ID: <20070206210557.2948f56d.khali@linux-fr.org> (raw)
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
reply other threads:[~2007-02-06 20:05 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070206210557.2948f56d.khali@linux-fr.org \
--to=khali@linux-fr.org \
--cc=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).