aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb-frontends/s5h1420.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/dvb-frontends/s5h1420.c')
-rw-r--r--drivers/media/dvb-frontends/s5h1420.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/media/dvb-frontends/s5h1420.c b/drivers/media/dvb-frontends/s5h1420.c
index e2fec9ebf947..93eeaf7118fd 100644
--- a/drivers/media/dvb-frontends/s5h1420.c
+++ b/drivers/media/dvb-frontends/s5h1420.c
@@ -836,9 +836,16 @@ static u32 s5h1420_tuner_i2c_func(struct i2c_adapter *adapter)
836static int s5h1420_tuner_i2c_tuner_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg msg[], int num) 836static int s5h1420_tuner_i2c_tuner_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg msg[], int num)
837{ 837{
838 struct s5h1420_state *state = i2c_get_adapdata(i2c_adap); 838 struct s5h1420_state *state = i2c_get_adapdata(i2c_adap);
839 struct i2c_msg m[1 + num]; 839 struct i2c_msg m[3];
840 u8 tx_open[2] = { CON_1, state->CON_1_val | 1 }; /* repeater stops once there was a stop condition */ 840 u8 tx_open[2] = { CON_1, state->CON_1_val | 1 }; /* repeater stops once there was a stop condition */
841 841
842 if (1 + num > ARRAY_SIZE(m)) {
843 printk(KERN_WARNING
844 "%s: i2c xfer: num=%d is too big!\n",
845 KBUILD_MODNAME, num);
846 return -EOPNOTSUPP;
847 }
848
842 memset(m, 0, sizeof(struct i2c_msg) * (1 + num)); 849 memset(m, 0, sizeof(struct i2c_msg) * (1 + num));
843 850
844 m[0].addr = state->config->demod_address; 851 m[0].addr = state->config->demod_address;
@@ -847,7 +854,7 @@ static int s5h1420_tuner_i2c_tuner_xfer(struct i2c_adapter *i2c_adap, struct i2c
847 854
848 memcpy(&m[1], msg, sizeof(struct i2c_msg) * num); 855 memcpy(&m[1], msg, sizeof(struct i2c_msg) * num);
849 856
850 return i2c_transfer(state->i2c, m, 1+num) == 1 + num ? num : -EIO; 857 return i2c_transfer(state->i2c, m, 1 + num) == 1 + num ? num : -EIO;
851} 858}
852 859
853static struct i2c_algorithm s5h1420_tuner_i2c_algo = { 860static struct i2c_algorithm s5h1420_tuner_i2c_algo = {