Skip to contentSkip to conversation

regmap: Add missing initialization of this_page

PATCH In review Geert Uytterhoeven 2 participants 2 messages Apr 22, 2014 – May 1, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 regmap: Add missing initialization of this_page

drivers/base/regmap/regmap.c: In function ‘_regmap_range_multi_paged_reg_write’:
drivers/base/regmap/regmap.c:1665: warning: ‘this_page’ may be used uninitialized in this function

---
This may be a false positive, if "range" is guaranteed to be non-zero during the first iteration of the loop

---
 drivers/base/regmap/regmap.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/regmap/regmap.c +1 -1
index 63e30ef096e2..0eaf581b2bb6 100644
@@ -1662,7 +1662,7 @@ static int _regmap_range_multi_paged_reg_write(struct regmap *map,
 	int ret;
 	int i, n;
 	struct reg_default *base;
-	unsigned int this_page;
+	unsigned int this_page = 0;
 	/*
 	 * the set of registers are not neccessarily in order, but
 	 * since the order of write must be preserved this algorithm
Signature · 1 line
1.7.9.5
maintainer
#1 lore raw
Quoted 7 lines · Geert Uytterhoeven

drivers/base/regmap/regmap.c: In function ‘_regmap_range_multi_paged_reg_write’:
drivers/base/regmap/regmap.c:1665: warning: ‘this_page’ may be used uninitialized in this function

---
This may be a false positive, if "range" is guaranteed to be non-zero during the first iteration of the loop

Applied, though with this sort of thing it's generally a bit better to do the init at the start of the loop rather than at declaration - init at declaration is a common pattern for just shutting up warnings as opposed to analyisng to make sure that there's really not an issue.