aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/tuner-core.c
diff options
context:
space:
mode:
authorMichael Krufky <mkrufky@linuxtv.org>2008-04-22 13:41:51 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-04-24 12:42:25 -0400
commitb65aa2605683d90966a16abc68112c1fd9e3f3d8 (patch)
tree40bac19f4c8185f571abd577e5feb65884bebbb2 /drivers/media/video/tuner-core.c
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/media/video/tuner-core.c')
-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)
317 tuner_warn("====================== WARNING! ======================\n"); 317 tuner_warn("====================== WARNING! ======================\n");
318} 318}
319 319
320static inline void attach_simple_tuner(struct tuner *t)
321{
322 simple_tuner_attach(&t->fe, t->i2c->adapter, t->i2c->addr, t->type);
323}
324
325static void attach_tda829x(struct tuner *t) 320static void attach_tda829x(struct tuner *t)
326{ 321{
327 struct tda829x_config cfg = { 322 struct tda829x_config cfg = {
@@ -399,7 +394,12 @@ static void set_type(struct i2c_client *c, unsigned int type,
399 buffer[2] = 0x86; 394 buffer[2] = 0x86;
400 buffer[3] = 0x54; 395 buffer[3] = 0x54;
401 i2c_master_send(c, buffer, 4); 396 i2c_master_send(c, buffer, 4);
402 attach_simple_tuner(t); 397 if (simple_tuner_attach(&t->fe, t->i2c->adapter, t->i2c->addr,
398 t->type) == NULL) {
399 t->type = TUNER_ABSENT;
400 t->mode_mask = T_UNINITIALIZED;
401 return;
402 }
403 break; 403 break;
404 case TUNER_PHILIPS_TD1316: 404 case TUNER_PHILIPS_TD1316:
405 buffer[0] = 0x0b; 405 buffer[0] = 0x0b;
@@ -407,7 +407,12 @@ static void set_type(struct i2c_client *c, unsigned int type,
407 buffer[2] = 0x86; 407 buffer[2] = 0x86;
408 buffer[3] = 0xa4; 408 buffer[3] = 0xa4;
409 i2c_master_send(c,buffer,4); 409 i2c_master_send(c,buffer,4);
410 attach_simple_tuner(t); 410 if (simple_tuner_attach(&t->fe, t->i2c->adapter,
411 t->i2c->addr, t->type) == NULL) {
412 t->type = TUNER_ABSENT;
413 t->mode_mask = T_UNINITIALIZED;
414 return;
415 }
411 break; 416 break;
412 case TUNER_XC2028: 417 case TUNER_XC2028:
413 { 418 {
@@ -445,7 +450,12 @@ static void set_type(struct i2c_client *c, unsigned int type,
445 } 450 }
446 break; 451 break;
447 default: 452 default:
448 attach_simple_tuner(t); 453 if (simple_tuner_attach(&t->fe, t->i2c->adapter,
454 t->i2c->addr, t->type) == NULL) {
455 t->type = TUNER_ABSENT;
456 t->mode_mask = T_UNINITIALIZED;
457 return;
458 }
449 break; 459 break;
450 } 460 }
451 461