summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorMichael Krufky <mkrufky@linuxtv.org>2008-04-22 14:41:51 -0300
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-04-24 13:42:25 -0300
commitb65aa2605683d90966a16abc68112c1fd9e3f3d8 (patch)
tree40bac19f4c8185f571abd577e5feb65884bebbb2 /drivers
parent060a5bd764a1d798c20eceeaac5399c672334960 (diff)
V4L/DVB (7128): tuner: properly handle failed calls to simple_tuner_attach
If simple_tuner_attach fails, set t->type to TUNER_ABSENT, set t->mode_mask to T_UNINITIALIZED, and exit the set_type function. Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/video/tuner-core.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c
index d6b64e9178eb..335a971298a3 100644
--- a/drivers/media/video/tuner-core.c
+++ b/drivers/media/video/tuner-core.c
@@ -317,11 +317,6 @@ static void tuner_i2c_address_check(struct tuner *t)
tuner_warn("====================== WARNING! ======================\n");
}
-static inline void attach_simple_tuner(struct tuner *t)
-{
- simple_tuner_attach(&t->fe, t->i2c->adapter, t->i2c->addr, t->type);
-}
-
static void attach_tda829x(struct tuner *t)
{
struct tda829x_config cfg = {
@@ -399,7 +394,12 @@ static void set_type(struct i2c_client *c, unsigned int type,
buffer[2] = 0x86;
buffer[3] = 0x54;
i2c_master_send(c, buffer, 4);
- attach_simple_tuner(t);
+ if (simple_tuner_attach(&t->fe, t->i2c->adapter, t->i2c->addr,
+ t->type) == NULL) {
+ t->type = TUNER_ABSENT;
+ t->mode_mask = T_UNINITIALIZED;
+ return;
+ }
break;
case TUNER_PHILIPS_TD1316:
buffer[0] = 0x0b;
@@ -407,7 +407,12 @@ static void set_type(struct i2c_client *c, unsigned int type,
buffer[2] = 0x86;
buffer[3] = 0xa4;
i2c_master_send(c,buffer,4);
- attach_simple_tuner(t);
+ if (simple_tuner_attach(&t->fe, t->i2c->adapter,
+ t->i2c->addr, t->type) == NULL) {
+ t->type = TUNER_ABSENT;
+ t->mode_mask = T_UNINITIALIZED;
+ return;
+ }
break;
case TUNER_XC2028:
{
@@ -445,7 +450,12 @@ static void set_type(struct i2c_client *c, unsigned int type,
}
break;
default:
- attach_simple_tuner(t);
+ if (simple_tuner_attach(&t->fe, t->i2c->adapter,
+ t->i2c->addr, t->type) == NULL) {
+ t->type = TUNER_ABSENT;
+ t->mode_mask = T_UNINITIALIZED;
+ return;
+ }
break;
}