Skip to contentSkip to conversation

genhd: overlapping variable definition

PATCH In review Stephen Hemminger 2 participants 2 messages Jan 6, 2010 – Jan 11, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 genhd: overlapping variable definition

This fixes the sparse warning:
fs/ext4/super.c:2390:40: warning: symbol 'i' shadows an earlier one fs/ext4/super.c:2368:22: originally declared here

Using 'i' in a macro is dubious practice.

include/linux/genhd.h +3 -3
@@ -256,9 +256,9 @@ extern struct hd_struct *disk_map_sector
 #define part_stat_read(part, field)					\
 ({									\
 	typeof((part)->dkstats->field) res = 0;				\
-	int i;								\
-	for_each_possible_cpu(i)					\
-		res += per_cpu_ptr((part)->dkstats, i)->field;		\
+	unsigned int _cpu;						\
+	for_each_possible_cpu(_cpu)					\
+		res += per_cpu_ptr((part)->dkstats, _cpu)->field;	\
 	res;								\
 })
 
#1 lore raw
Quoted 5 lines · Stephen Hemminger

This fixes the sparse warning:
fs/ext4/super.c:2390:40: warning: symbol 'i' shadows an earlier one fs/ext4/super.c:2368:22: originally declared here

Using 'i' in a macro is dubious practice.

Indeed, applied. Thanks!

Signature · 1 line
Jens Axboe