Skip to contentSkip to conversation

autofs4: fix sparse warning in root.c

PATCH In review Harvey Harrison 2 participants 4 messages Feb 16, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 autofs4: fix sparse warning in root.c

fs/autofs4/root.c:536:23: warning: symbol 'ino' shadows an earlier one fs/autofs4/root.c:510:22: originally declared here

There is no need to redeclare, we are at the end of the loop and in the next iteration of the loop, ino will be reset.

---
 fs/autofs4/root.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/autofs4/root.c +1 -1
index a54a946..1b43456 100644
@@ -533,8 +533,8 @@ static struct dentry *autofs4_lookup_unhashed(struct autofs_sb_info *sbi, struct
 			goto next;
 
 		if (d_unhashed(dentry)) {
-			struct autofs_info *ino = autofs4_dentry_ino(dentry);
 			struct inode *inode = dentry->d_inode;
+			ino = autofs4_dentry_ino(dentry);
 
 			list_del_init(&ino->rehash);
 			dget(dentry);
Signature · 1 line
1.5.4.1.1278.gc75be
#1 lore raw
Quoted 5 lines · Harvey Harrison

fs/autofs4/root.c:536:23: warning: symbol 'ino' shadows an earlier one fs/autofs4/root.c:510:22: originally declared here

There is no need to redeclare, we are at the end of the loop and in the next iteration of the loop, ino will be reset.

Of course, this is fine.

But I like to leave a blank line between declarative and procedural statements or no blank line at all if it looks natural, usually when there are only a few lines of code.

Picky I know, but in this case I'd prefer moving the assignment down one line.

Quoted 20 lines
---
 fs/autofs4/root.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/autofs4/root.c +1 -1
index a54a946..1b43456 100644
@@ -533,8 +533,8 @@ static struct dentry *autofs4_lookup_unhashed(struct autofs_sb_info *sbi, struct
 			goto next;
 
 		if (d_unhashed(dentry)) {
-			struct autofs_info *ino = autofs4_dentry_ino(dentry);
 			struct inode *inode = dentry->d_inode;
+			ino = autofs4_dentry_ino(dentry);
 
 			list_del_init(&ino->rehash);
 			dget(dentry);
#2 lore raw

fs/autofs4/root.c:536:23: warning: symbol 'ino' shadows an earlier one fs/autofs4/root.c:510:22: originally declared here

There is no need to redeclare, we are at the end of the loop and in the next iteration of the loop, ino will be reset.

---
 fs/autofs4/root.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/autofs4/root.c +1 -1
index a54a946..aa4c5ff 100644
@@ -533,9 +533,9 @@ static struct dentry *autofs4_lookup_unhashed(struct autofs_sb_info *sbi, struct
 			goto next;
 
 		if (d_unhashed(dentry)) {
-			struct autofs_info *ino = autofs4_dentry_ino(dentry);
 			struct inode *inode = dentry->d_inode;
 
+			ino = autofs4_dentry_ino(dentry);
 			list_del_init(&ino->rehash);
 			dget(dentry);
 			/*
Signature · 1 line
1.5.4.1.1278.gc75be
Acked-by
#3 lore raw
Quoted 7 lines · Harvey Harrison

fs/autofs4/root.c:536:23: warning: symbol 'ino' shadows an earlier one fs/autofs4/root.c:510:22: originally declared here

There is no need to redeclare, we are at the end of the loop and in the next iteration of the loop, ino will be reset.

Quoted 19 lines
---
 fs/autofs4/root.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/autofs4/root.c +1 -1
index a54a946..aa4c5ff 100644
@@ -533,9 +533,9 @@ static struct dentry *autofs4_lookup_unhashed(struct autofs_sb_info *sbi, struct
 			goto next;
 
 		if (d_unhashed(dentry)) {
-			struct autofs_info *ino = autofs4_dentry_ino(dentry);
 			struct inode *inode = dentry->d_inode;
 
+			ino = autofs4_dentry_ino(dentry);
 			list_del_init(&ino->rehash);
 			dget(dentry);
 			/*