summaryrefslogtreecommitdiffstats
path: root/drivers/media/video/tuner-simple.c
diff options
context:
space:
mode:
authorMichael Krufky2008-04-22 19:41:50 +0200
committerMauro Carvalho Chehab2008-04-24 18:42:23 +0200
commit65e8d29f7a37faaf9c73c633447bebd4b31b2c89 (patch)
tree9e4d72f4a6710d3435ae51499d74cdf2c7a8f916 /drivers/media/video/tuner-simple.c
parentV4L/DVB (7125): tuner: build tuner-types independently of tuner-core (diff)
downloadkernel-qcow2-linux-65e8d29f7a37faaf9c73c633447bebd4b31b2c89.tar.gz
kernel-qcow2-linux-65e8d29f7a37faaf9c73c633447bebd4b31b2c89.tar.xz
kernel-qcow2-linux-65e8d29f7a37faaf9c73c633447bebd4b31b2c89.zip
V4L/DVB (7126): tuner: move tuner type ID check to simple_tuner_attach
Move tuner type ID check from tuner-core::set_type to simple_tuner_attach. Since tuner-core forwards all attach requests to tuner-simple as the default case, unless a specific attach function is specified in set_type, this change is an appropriate cleanup. Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/tuner-simple.c')
-rw-r--r--drivers/media/video/tuner-simple.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/media/video/tuner-simple.c b/drivers/media/video/tuner-simple.c
index 85556d44c8ab..d3362703e258 100644
--- a/drivers/media/video/tuner-simple.c
+++ b/drivers/media/video/tuner-simple.c
@@ -688,6 +688,12 @@ struct dvb_frontend *simple_tuner_attach(struct dvb_frontend *fe,
{
struct tuner_simple_priv *priv = NULL;
+ if (type >= tuner_count) {
+ printk(KERN_WARNING "%s: invalid tuner type: %d (max: %d)\n",
+ __FUNCTION__, type, tuner_count-1);
+ return NULL;
+ }
+
priv = kzalloc(sizeof(struct tuner_simple_priv), GFP_KERNEL);
if (priv == NULL)
return NULL;