V4L/DVB (10505): tda8290: Print an error if i2c_gate is not provided
authorMauro Carvalho Chehab <mchehab@redhat.com>
Sun, 8 Feb 2009 11:42:29 +0000 (08:42 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Mon, 30 Mar 2009 15:42:42 +0000 (12:42 -0300)
While here, be sure that gate will be kept disabled if an error occurs.

Cc: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/common/tuners/tda8290.c

index 4b8662e..39697fa 100644 (file)
@@ -566,8 +566,11 @@ static int tda829x_find_tuner(struct dvb_frontend *fe)
        u8 data;
        struct i2c_msg msg = { .flags = I2C_M_RD, .buf = &data, .len = 1 };
 
-       if (NULL == analog_ops->i2c_gate_ctrl)
+       if (!analog_ops->i2c_gate_ctrl) {
+               printk(KERN_ERR "tda8290: no gate control were provided!\n");
+
                return -EINVAL;
+       }
 
        analog_ops->i2c_gate_ctrl(fe, 1);
 
@@ -615,6 +618,7 @@ static int tda829x_find_tuner(struct dvb_frontend *fe)
 
        if (ret != 1) {
                tuner_warn("tuner access failed!\n");
+               analog_ops->i2c_gate_ctrl(fe, 0);
                return -EREMOTEIO;
        }