summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlli Salonen <olli.salonen@iki.fi>2016-03-16 12:04:51 +0100
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2016-06-07 22:10:04 +0200
commit212fa081262e17affb1aa3ed8fd7a5b2fffbfc00 (patch)
tree0f7a3982cd256193c9a7ec42a448a9b6e842a386
parent[media] fix semicolon.cocci warnings (diff)
downloadlinux-212fa081262e17affb1aa3ed8fd7a5b2fffbfc00.tar.xz
linux-212fa081262e17affb1aa3ed8fd7a5b2fffbfc00.zip
[media] ds3000: return error if invalid symbol rate is set
Return -EINVAL if ds3000_set_frontend is called with invalid parameters. v1 of the patch series got incorrect subject lines. Signed-off-by: Olli Salonen <olli.salonen@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
-rw-r--r--drivers/media/dvb-frontends/ds3000.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/media/dvb-frontends/ds3000.c b/drivers/media/dvb-frontends/ds3000.c
index addffc33993a..447b518e287a 100644
--- a/drivers/media/dvb-frontends/ds3000.c
+++ b/drivers/media/dvb-frontends/ds3000.c
@@ -959,6 +959,15 @@ static int ds3000_set_frontend(struct dvb_frontend *fe)
/* enable ac coupling */
ds3000_writereg(state, 0x25, 0x8a);
+ if ((c->symbol_rate < ds3000_ops.info.symbol_rate_min) ||
+ (c->symbol_rate > ds3000_ops.info.symbol_rate_max)) {
+ dprintk("%s() symbol_rate %u out of range (%u ... %u)\n",
+ __func__, c->symbol_rate,
+ ds3000_ops.info.symbol_rate_min,
+ ds3000_ops.info.symbol_rate_max);
+ return -EINVAL;
+ }
+
/* enhance symbol rate performance */
if ((c->symbol_rate / 1000) <= 5000) {
value = 29777 / (c->symbol_rate / 1000) + 1;