Skip to contentSkip to conversation

r820t: quiet gcc warning on n_ring

PATCH New Fengguang Wu 1 participant 1 message Apr 20, 2013 2 messages not in the archive Media (V4L/DVB)

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 516ff3b5.J3wZZ5D4m/PHbRWT%[email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

PATCH 1/1 r820t: quiet gcc warning on n_ring

drivers/media/tuners/r820t.c: In function 'r820t_imr':
drivers/media/tuners/r820t.c:1871:8: warning: 'n_ring' may be used uninitialized in this function [-Wmaybe-uninitialized]

Mauro: This is a FALSE POSITIVE: the loop will always return a value for n_ring, as the last test will fill it with 15, if the loop fails.

---
 drivers/media/tuners/r820t.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/media/tuners/r820t.c +1 -4
index fa2e9ae..a975ffe 100644
@@ -1852,15 +1852,12 @@ static int r820t_imr(struct r820t_priv *priv, unsigned imr_mem, bool im_flag)
 	else
 		ring_ref = priv->cfg->xtal;
 
+	n_ring = 15;
 	for (n = 0; n < 16; n++) {
 		if ((16 + n) * 8 * ring_ref >= 3100000) {
 			n_ring = n;
 			break;
 		}
-
-		/* n_ring not found */
-		if (n == 15)
-			n_ring = n;
 	}
 
 	reg18 = r820t_read_cache_reg(priv, 0x18);
Signature · 1 line
1.7.10.4