This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/cgit.cgi/media_tree.git tree:

Subject: [media] drxj: don't do math if not needed
Author:  Mauro Carvalho Chehab <[email protected]>
Date:    Sat Feb 27 07:51:08 2016 -0300

While there's no risk of divison by zero, the logic there is akward, as it
does the calculus for the numerator and denominator before checking
if this will be used.

Change the order to check first if the denominator is zero, and only
calculating the numerator/denominator if not.

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 <[email protected]>

 drivers/media/dvb-frontends/drx39xyj/drxj.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

---

http://git.linuxtv.org/cgit.cgi/media_tree.git/commit/?id=b6554ea5511ac748051144d6789d49ea9a61ddfd
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;

_______________________________________________
linuxtv-commits mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to