diff options
author | Michael Krufky <mkrufky@linuxtv.org> | 2008-01-28 08:55:06 -0500 |
---|---|---|
committer | Michael Krufky <mkrufky@linuxtv.org> | 2008-01-28 08:55:06 -0500 |
commit | b8a8b11e41806fa8b84600f783ba8db358baf088 (patch) | |
tree | e94ca000bc0adc9ac01f807b1533d815838d782e /linux/drivers/media/video | |
parent | 7883d9b792eee4d57e9c7e7f7df45ca17c8bfdab (diff) | |
download | mediapointer-dvb-s2-b8a8b11e41806fa8b84600f783ba8db358baf088.tar.gz mediapointer-dvb-s2-b8a8b11e41806fa8b84600f783ba8db358baf088.tar.bz2 |
tuner: properly handle failed calls to simple_tuner_attach
From: Michael Krufky <mkrufky@linuxtv.org>
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>
Diffstat (limited to 'linux/drivers/media/video')
-rw-r--r-- | linux/drivers/media/video/tuner-core.c | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/linux/drivers/media/video/tuner-core.c b/linux/drivers/media/video/tuner-core.c index 9fb321088..2117254b7 100644 --- a/linux/drivers/media/video/tuner-core.c +++ b/linux/drivers/media/video/tuner-core.c @@ -346,11 +346,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 = { @@ -428,7 +423,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; @@ -436,7 +436,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: { @@ -474,7 +479,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; } |