Skip to contentSkip to conversation

initialize variables in fs/isofs/namei.c

PATCH In review Ameer Armaly 2 participants 3 messages May 21, 2006 Isofs filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 initialize variables in fs/isofs/namei.c

This patch removes un-initialized variable warnings for block and offset in namei.c, which are later initialized through a call to isofs_find_entry().

fs/isofs/namei.c +1 -1
index e7ba0c3..e0d6531 100644
@@ -159,7 +159,7 @@ #endif
 struct dentry *isofs_lookup(struct inode * dir, struct dentry * dentry, struct nameidata *nd)
 {
 	int found;
-	unsigned long block, offset;
+	unsigned long block = 0, offset = 0;
 	struct inode *inode;
 	struct page *page;
 
#1 lore raw
Quoted 2 lines · Ameer Armaly

This patch removes un-initialized variable warnings for block and offset in namei.c, which are later initialized through a call to isofs_find_entry().

Which indicates the problem lies with gcc, just like with the other patches 'fixing' these warnings.

The warning is bogus.

Dave

Signature · 1 line
http://www.codemonkey.org.uk
#2 lore raw
Quoted 7 lines · Dave Jones
Quoted 2 lines · Ameer Armaly

This patch removes un-initialized variable warnings for block and offset in namei.c, which are later initialized through a call to isofs_find_entry().

Which indicates the problem lies with gcc, just like with the other patches 'fixing' these warnings.

I agree. The compiler should be smart enough to at least consider the possibility of initializing through pointers.

Quoted 2 lines

The warning is bogus.

It is, but at the same it's clutter; in my opinion, readability is not impacted by explicitly initializing variables that get initialized through a pointer, and we reduce annoying make output.

Quoted 10 lines

Dave

Signature · 6 lines
http://www.codemonkey.org.uk
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/