All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
To: unlisted-recipients:; (no To-header on input)@casper.infradead.org
Cc: Mauro Carvalho Chehab <mchehab@osg.samsung.com>,
	Linux Media Mailing List <linux-media@vger.kernel.org>,
	Mauro Carvalho Chehab <mchehab@infradead.org>,
	Stefan Richter <stefanr@s5r6.in-berlin.de>,
	Cheolhyun Park <pch851130@gmail.com>,
	Hans Verkuil <hans.verkuil@cisco.com>
Subject: [PATCH 2/7] [media] drxj: don't do math if not needed
Date: Sat, 27 Feb 2016 07:51:08 -0300	[thread overview]
Message-ID: <388e3b822807eb2600fbaab514c3759131e235d6.1456570258.git.mchehab@osg.samsung.com> (raw)
In-Reply-To: <d7bc635a625d7ab19ed5a81135044e086d330d1b.1456570258.git.mchehab@osg.samsung.com>
In-Reply-To: <d7bc635a625d7ab19ed5a81135044e086d330d1b.1456570258.git.mchehab@osg.samsung.com>

This should also avoid those smatch errors:
	drivers/media/dvb-frontends/drx39xyj/drxj.c:9605 ctrl_get_qam_sig_quality() debug: sval_binop_unsigned: divide by zero
	drivers/media/dvb-frontends/drx39xyj/drxj.c:9605 ctrl_get_qam_sig_quality() debug: sval_binop_unsigned: divide by zero
	drivers/media/dvb-frontends/drx39xyj/drxj.c:9605 ctrl_get_qam_sig_quality() debug: sval_binop_unsigned: divide by zero
	drivers/media/dvb-frontends/drx39xyj/drxj.c:9605 ctrl_get_qam_sig_quality() debug: sval_binop_unsigned: divide by zero
	drivers/media/dvb-frontends/drx39xyj/drxj.c:9605 ctrl_get_qam_sig_quality() debug: sval_binop_unsigned: divide by zero

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
---
 drivers/media/dvb-frontends/drx39xyj/drxj.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/media/dvb-frontends/drx39xyj/drxj.c b/drivers/media/dvb-frontends/drx39xyj/drxj.c
index 51715421bc4f..e48b741d439e 100644
--- a/drivers/media/dvb-frontends/drx39xyj/drxj.c
+++ b/drivers/media/dvb-frontends/drx39xyj/drxj.c
@@ -9597,12 +9597,13 @@ ctrl_get_qam_sig_quality(struct drx_demod_instance *demod)
 
 	   Precision errors still possible.
 	 */
-	e = post_bit_err_rs * 742686;
-	m = fec_oc_period * 100;
-	if (fec_oc_period == 0)
+	if (!fec_oc_period) {
 		qam_post_rs_ber = 0xFFFFFFFF;
-	else
+	} else {
+		e = post_bit_err_rs * 742686;
+		m = fec_oc_period * 100;
 		qam_post_rs_ber = e / m;
+	}
 
 	/* fill signal quality data structure */
 	p->pre_bit_count.stat[0].scale = FE_SCALE_COUNTER;
-- 
2.5.0


  reply	other threads:[~2016-02-27 10:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-27 10:51 [PATCH 1/7] [media] airspy: fix bit set/clean mess on s->flags Mauro Carvalho Chehab
2016-02-27 10:51 ` Mauro Carvalho Chehab [this message]
2016-02-27 10:51 ` [PATCH 3/7] [media] dib0090: Do the right check for state->rf_ramp Mauro Carvalho Chehab
2016-02-27 10:51 ` [PATCH 4/7] [media] technisat-usb2: don't do DMA on the stack Mauro Carvalho Chehab
2016-02-27 10:51 ` [PATCH 5/7] [media] pt3: fix device identification Mauro Carvalho Chehab
2016-02-27 10:51 ` [PATCH 6/7] [media] ati_remote: Put timeouts at the accel array Mauro Carvalho Chehab
2016-02-27 10:51 ` [PATCH 7/7] [media] lirc_dev: avoid double mutex unlock Mauro Carvalho Chehab

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=388e3b822807eb2600fbaab514c3759131e235d6.1456570258.git.mchehab@osg.samsung.com \
    --to=mchehab@osg.samsung.com \
    --cc=hans.verkuil@cisco.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@infradead.org \
    --cc=pch851130@gmail.com \
    --cc=stefanr@s5r6.in-berlin.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.