diff options
author | Florian Mickler <florian@mickler.org> | 2011-03-21 14:33:43 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-05-20 08:27:57 -0400 |
commit | 0e4e7208e6b33816c457292ee771da3a5779027b (patch) | |
tree | ed2fbddf1854d87281849562aaba314740a5c8b3 /drivers/media/dvb/dvb-usb | |
parent | ab22cbda6651db25d03052aa9ee9452b5eaa3edd (diff) |
[media] friio: get rid of on-stack dma buffers
usb_control_msg initiates (and waits for completion of) a dma transfer using
the supplied buffer. That buffer thus has to be seperately allocated on
the heap.
In lib/dma_debug.c the function check_for_stack even warns about it:
WARNING: at lib/dma-debug.c:866 check_for_stack
Note: This change is tested to compile only, as I don't have the hardware.
Signed-off-by: Florian Mickler <florian@mickler.org>
Cc: Akihiro Tsukada <tskd2@yahoo.co.jp>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb/dvb-usb')
-rw-r--r-- | drivers/media/dvb/dvb-usb/friio.c | 23 |
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 | |||
146 | static int friio_ext_ctl(struct dvb_usb_adapter *adap, | 145 | static 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 | ||
360 | error: | 373 | error: |
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 | } |