From patchwork Fri Aug 27 10:43:07 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Igor M. Liplianin" X-Patchwork-Id: 5382 Return-path: Envelope-to: mchehab@gaivota Delivery-date: Fri, 31 Dec 2010 08:15:32 -0200 Received: from mchehab by gaivota with local (Exim 4.72) (envelope-from ) id 1PYc1E-0002Qu-Jo for mchehab@gaivota; Fri, 31 Dec 2010 08:15:32 -0200 Received: from casper.infradead.org [85.118.1.10] by gaivota with IMAP (fetchmail-6.3.17) for (single-drop); Fri, 31 Dec 2010 08:15:32 -0200 (BRST) Received: from vger.kernel.org ([209.132.180.67]) by casper.infradead.org with esmtp (Exim 4.72 #1 (Red Hat Linux)) id 1PYXcK-00017K-Ad; Fri, 31 Dec 2010 05:33:32 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752687Ab0LaFcy (ORCPT + 1 other); Fri, 31 Dec 2010 00:32:54 -0500 Received: from mail-ey0-f174.google.com ([209.85.215.174]:62492 "EHLO mail-ey0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751050Ab0LaFcI (ORCPT ); Fri, 31 Dec 2010 00:32:08 -0500 Received: by mail-ey0-f174.google.com with SMTP id 27so5151171eye.19 for ; Thu, 30 Dec 2010 21:32:08 -0800 (PST) Received: by 10.213.22.209 with SMTP id o17mr13167481ebb.41.1293773527996; Thu, 30 Dec 2010 21:32:07 -0800 (PST) Received: from useri.localnet ([93.125.74.3]) by mx.google.com with ESMTPS id t5sm11994271eeh.8.2010.12.30.21.32.06 (version=SSLv3 cipher=RC4-MD5); Thu, 30 Dec 2010 21:32:07 -0800 (PST) Message-ID: <4d1d6ad7.857a0e0a.45e5.ffffd91b@mx.google.com> From: "Igor M. Liplianin" Date: Fri, 27 Aug 2010 14:43:07 +0400 Subject: [PATCH 09/18] stv0367: Fix potential divide error To: , linux-media@vger.kernel.org, , Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Sender: Mauro Carvalho Chehab Signed-off-by: Igor M. Liplianin --- 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;