diff mbox

[09/18] stv0367: Fix potential divide error

Message ID 4d1ef497.52790e0a.1192.06a8@mx.google.com (mailing list archive)
State Superseded
Headers show

Commit Message

Igor M. Liplianin Dec. 31, 2010, 11:37 a.m. UTC
None
diff mbox

Patch

diff --git a/drivers/media/dvb/frontends/stv0367.c b/drivers/media/dvb/frontends/stv0367.c
index 0575741..e6bee7f 100644
--- a/drivers/media/dvb/frontends/stv0367.c
+++ b/drivers/media/dvb/frontends/stv0367.c
@@ -3275,12 +3275,14 @@  static int stv0367cab_read_snr(struct dvb_frontend *fe, u16 *snr)
 		power = 1;
 		break;
 	}
+
 	for (i = 0; i < 10; i++) {
 		regval += (stv0367_readbits(state, F367CAB_SNR_LO)
 			+ 256 * stv0367_readbits(state, F367CAB_SNR_HI));
 	}
+
+	regval /= 10; /*for average over 10 times in for loop above*/
 	if (regval != 0) {
-		regval /= 10; /*for average over 10 times in for loop above*/
 		temp = power
 			* (1 << (3 + stv0367_readbits(state, F367CAB_SNR_PER)));
 		temp /= regval;