aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/dvb/dvb-usb/friio.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/drivers/media/dvb/dvb-usb/friio.c b/drivers/media/dvb/dvb-usb/friio.c
index 14a65b4aec07..76159aed9bb0 100644
--- a/drivers/media/dvb/dvb-usb/friio.c
+++ b/drivers/media/dvb/dvb-usb/friio.c
@@ -142,17 +142,20 @@ static u32 gl861_i2c_func(struct i2c_adapter *adapter)
142 return I2C_FUNC_I2C; 142 return I2C_FUNC_I2C;
143} 143}
144 144
145
146static int friio_ext_ctl(struct dvb_usb_adapter *adap, 145static int friio_ext_ctl(struct dvb_usb_adapter *adap,
147 u32 sat_color, int lnb_on) 146 u32 sat_color, int lnb_on)
148{ 147{
149 int i; 148 int i;
150 int ret; 149 int ret;
151 struct i2c_msg msg; 150 struct i2c_msg msg;
152 u8 buf[2]; 151 u8 *buf;
153 u32 mask; 152 u32 mask;
154 u8 lnb = (lnb_on) ? FRIIO_CTL_LNB : 0; 153 u8 lnb = (lnb_on) ? FRIIO_CTL_LNB : 0;
155 154
155 buf = kmalloc(2, GFP_KERNEL);
156 if (!buf)
157 return -ENOMEM;
158
156 msg.addr = 0x00; 159 msg.addr = 0x00;
157 msg.flags = 0; 160 msg.flags = 0;
158 msg.len = 2; 161 msg.len = 2;
@@ -189,6 +192,7 @@ static int friio_ext_ctl(struct dvb_usb_adapter *adap,
189 buf[1] |= FRIIO_CTL_CLK; 192 buf[1] |= FRIIO_CTL_CLK;
190 ret += gl861_i2c_xfer(&adap->dev->i2c_adap, &msg, 1); 193 ret += gl861_i2c_xfer(&adap->dev->i2c_adap, &msg, 1);
191 194
195 kfree(buf);
192 return (ret == 70); 196 return (ret == 70);
193} 197}
194 198
@@ -219,11 +223,20 @@ static int friio_initialize(struct dvb_usb_device *d)
219 int ret; 223 int ret;
220 int i; 224 int i;
221 int retry = 0; 225 int retry = 0;
222 u8 rbuf[2]; 226 u8 *rbuf, *wbuf;
223 u8 wbuf[3];
224 227
225 deb_info("%s called.\n", __func__); 228 deb_info("%s called.\n", __func__);
226 229
230 wbuf = kmalloc(3, GFP_KERNEL);
231 if (!wbuf)
232 return -ENOMEM;
233
234 rbuf = kmalloc(2, GFP_KERNEL);
235 if (!rbuf) {
236 kfree(wbuf);
237 return -ENOMEM;
238 }
239
227 /* use gl861_i2c_msg instead of gl861_i2c_xfer(), */ 240 /* use gl861_i2c_msg instead of gl861_i2c_xfer(), */
228 /* because the i2c device is not set up yet. */ 241 /* because the i2c device is not set up yet. */
229 wbuf[0] = 0x11; 242 wbuf[0] = 0x11;
@@ -358,6 +371,8 @@ restart:
358 return 0; 371 return 0;
359 372
360error: 373error:
374 kfree(wbuf);
375 kfree(rbuf);
361 deb_info("%s:ret == %d\n", __func__, ret); 376 deb_info("%s:ret == %d\n", __func__, ret);
362 return -EIO; 377 return -EIO;
363} 378}