From 5c7b0a4903598f353459c8f2101e7f0023d3e8af Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Mon, 28 Jan 2008 08:50:21 -0500 Subject: tuner: move tuner type ID check to simple_tuner_attach From: Michael Krufky 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 --- linux/drivers/media/video/tuner-core.c | 5 ----- linux/drivers/media/video/tuner-simple.c | 6 ++++++ 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'linux') diff --git a/linux/drivers/media/video/tuner-core.c b/linux/drivers/media/video/tuner-core.c index 95bb41cee..c35528799 100644 --- a/linux/drivers/media/video/tuner-core.c +++ b/linux/drivers/media/video/tuner-core.c @@ -381,11 +381,6 @@ static void set_type(struct i2c_client *c, unsigned int type, return; } - if (type >= tuner_count) { - tuner_warn ("tuner 0x%02x: Tuner count greater than %d\n",c->addr,tuner_count); - return; - } - t->type = type; t->config = new_config; if (tuner_callback != NULL) { diff --git a/linux/drivers/media/video/tuner-simple.c b/linux/drivers/media/video/tuner-simple.c index a89dee2a7..cd3a3bae9 100644 --- a/linux/drivers/media/video/tuner-simple.c +++ b/linux/drivers/media/video/tuner-simple.c @@ -723,6 +723,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; -- cgit v1.2.3