summaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb-frontends
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@s-opensource.com>2017-06-25 09:07:45 -0300
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2017-06-25 09:07:45 -0300
commitf5a1ba833ddfd801b4adc463b0705938a8ff632f (patch)
tree70e83dfe2e02955557c7b81b815f0851add98f6a /drivers/media/dvb-frontends
parentd394ad12c2e0354a18e34ad803f685b795b01fc4 (diff)
media: stv0367: prevent division by zero
While there's a test at the SNR calculus to avoid division by zero, it will still follow the path that would do the division. So, add a missing break there. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/dvb-frontends')
-rw-r--r--drivers/media/dvb-frontends/stv0367.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/media/dvb-frontends/stv0367.c b/drivers/media/dvb-frontends/stv0367.c
index fee2a1554203..e7bed20e80f6 100644
--- a/drivers/media/dvb-frontends/stv0367.c
+++ b/drivers/media/dvb-frontends/stv0367.c
@@ -3014,8 +3014,10 @@ static void stv0367ddb_read_snr(struct dvb_frontend *fe)
regval = stv0367cab_snr_readreg(fe, 0);
/* prevent division by zero */
- if (!regval)
+ if (!regval) {
snrval = 0;
+ break;
+ }
tmpval = (cab_pwr * 320) / regval;
snrval = ((tmpval != 0) ? (intlog2(tmpval) / 5581) : 0);