V4L/DVB (4874): Fix oops on symbol rate==0
authorAndrew de Quincey <adq_dvb@lidskialf.net>
Wed, 22 Nov 2006 21:01:21 +0000 (18:01 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Sun, 26 Nov 2006 13:02:43 +0000 (11:02 -0200)
The tda10086 causes an oops (divide by zero) if a zero symbol rate is used;
this prevents this.

Signed-off-by: Andrew de Quincey <adq_dvb@lidskialf.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
drivers/media/dvb/frontends/tda10086.c

index 7456b0b9976b0ebbacc8a61bf686101b14d05a13..4c27a2d90a38cf1e3f763a6535bd2d1113775720 100644 (file)
@@ -441,6 +441,10 @@ static int tda10086_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_pa
 
        dprintk ("%s\n", __FUNCTION__);
 
+       // check for invalid symbol rate
+       if (fe_params->u.qpsk.symbol_rate < 500000)
+               return -EINVAL;
+
        // calculate the updated frequency (note: we convert from Hz->kHz)
        tmp64 = tda10086_read_byte(state, 0x52);
        tmp64 |= (tda10086_read_byte(state, 0x51) << 8);