mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Igor M. Liplianin" <liplianin@me.by>
To: <mchehab@infradead.org>, <linux-media@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: [PATCH 09/18] stv0367: Fix potential divide error
Date: Fri, 31 Dec 2010 13:37:00 +0200	[thread overview]
Message-ID: <4d1ef497.52790e0a.1192.06a8@mx.google.com> (raw)

Signed-off-by: Igor M. Liplianin <liplianin@netup.ru>
---
 drivers/media/dvb/frontends/stv0367.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

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;
-- 
1.7.1


             reply	other threads:[~2011-01-01  9:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-31 11:37 Igor M. Liplianin [this message]
  -- strict thread matches above, loose matches on Subject: below --
2010-08-27 10:43 Igor M. Liplianin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4d1ef497.52790e0a.1192.06a8@mx.google.com \
    --to=liplianin@me.by \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®