diff options
author | Florian Mickler <florian@mickler.org> | 2011-03-21 14:33:45 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-05-20 08:27:59 -0400 |
commit | 513ea35ff9cd332abe650f5da3689bdb41824b43 (patch) | |
tree | 4f61ff4ea83e2326064fb19e845b6e80ea53ce74 /drivers/media/dvb | |
parent | b47b850116369a474f71c8ee1e7d06dfa9bf5468 (diff) |
[media] m920x: 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: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb')
-rw-r--r-- | drivers/media/dvb/dvb-usb/m920x.c | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/drivers/media/dvb/dvb-usb/m920x.c b/drivers/media/dvb/dvb-usb/m920x.c index 51bfd42387c..9456792f219 100644 --- a/drivers/media/dvb/dvb-usb/m920x.c +++ b/drivers/media/dvb/dvb-usb/m920x.c | |||
@@ -134,13 +134,17 @@ static int m920x_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | |||
134 | { | 134 | { |
135 | struct m920x_state *m = d->priv; | 135 | struct m920x_state *m = d->priv; |
136 | int i, ret = 0; | 136 | int i, ret = 0; |
137 | u8 rc_state[2]; | 137 | u8 *rc_state; |
138 | |||
139 | rc_state = kmalloc(2, GFP_KERNEL); | ||
140 | if (!rc_state) | ||
141 | return -ENOMEM; | ||
138 | 142 | ||
139 | if ((ret = m920x_read(d->udev, M9206_CORE, 0x0, M9206_RC_STATE, rc_state, 1)) != 0) | 143 | if ((ret = m920x_read(d->udev, M9206_CORE, 0x0, M9206_RC_STATE, rc_state, 1)) != 0) |
140 | goto unlock; | 144 | goto out; |
141 | 145 | ||
142 | if ((ret = m920x_read(d->udev, M9206_CORE, 0x0, M9206_RC_KEY, rc_state + 1, 1)) != 0) | 146 | if ((ret = m920x_read(d->udev, M9206_CORE, 0x0, M9206_RC_KEY, rc_state + 1, 1)) != 0) |
143 | goto unlock; | 147 | goto out; |
144 | 148 | ||
145 | for (i = 0; i < d->props.rc.legacy.rc_map_size; i++) | 149 | for (i = 0; i < d->props.rc.legacy.rc_map_size; i++) |
146 | if (rc5_data(&d->props.rc.legacy.rc_map_table[i]) == rc_state[1]) { | 150 | if (rc5_data(&d->props.rc.legacy.rc_map_table[i]) == rc_state[1]) { |
@@ -149,7 +153,7 @@ static int m920x_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | |||
149 | switch(rc_state[0]) { | 153 | switch(rc_state[0]) { |
150 | case 0x80: | 154 | case 0x80: |
151 | *state = REMOTE_NO_KEY_PRESSED; | 155 | *state = REMOTE_NO_KEY_PRESSED; |
152 | goto unlock; | 156 | goto out; |
153 | 157 | ||
154 | case 0x88: /* framing error or "invalid code" */ | 158 | case 0x88: /* framing error or "invalid code" */ |
155 | case 0x99: | 159 | case 0x99: |
@@ -157,7 +161,7 @@ static int m920x_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | |||
157 | case 0xd8: | 161 | case 0xd8: |
158 | *state = REMOTE_NO_KEY_PRESSED; | 162 | *state = REMOTE_NO_KEY_PRESSED; |
159 | m->rep_count = 0; | 163 | m->rep_count = 0; |
160 | goto unlock; | 164 | goto out; |
161 | 165 | ||
162 | case 0x93: | 166 | case 0x93: |
163 | case 0x92: | 167 | case 0x92: |
@@ -165,7 +169,7 @@ static int m920x_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | |||
165 | case 0x82: | 169 | case 0x82: |
166 | m->rep_count = 0; | 170 | m->rep_count = 0; |
167 | *state = REMOTE_KEY_PRESSED; | 171 | *state = REMOTE_KEY_PRESSED; |
168 | goto unlock; | 172 | goto out; |
169 | 173 | ||
170 | case 0x91: | 174 | case 0x91: |
171 | case 0x81: /* pinnacle PCTV310e */ | 175 | case 0x81: /* pinnacle PCTV310e */ |
@@ -174,12 +178,12 @@ static int m920x_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | |||
174 | *state = REMOTE_KEY_REPEAT; | 178 | *state = REMOTE_KEY_REPEAT; |
175 | else | 179 | else |
176 | *state = REMOTE_NO_KEY_PRESSED; | 180 | *state = REMOTE_NO_KEY_PRESSED; |
177 | goto unlock; | 181 | goto out; |
178 | 182 | ||
179 | default: | 183 | default: |
180 | deb("Unexpected rc state %02x\n", rc_state[0]); | 184 | deb("Unexpected rc state %02x\n", rc_state[0]); |
181 | *state = REMOTE_NO_KEY_PRESSED; | 185 | *state = REMOTE_NO_KEY_PRESSED; |
182 | goto unlock; | 186 | goto out; |
183 | } | 187 | } |
184 | } | 188 | } |
185 | 189 | ||
@@ -188,8 +192,8 @@ static int m920x_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | |||
188 | 192 | ||
189 | *state = REMOTE_NO_KEY_PRESSED; | 193 | *state = REMOTE_NO_KEY_PRESSED; |
190 | 194 | ||
191 | unlock: | 195 | out: |
192 | 196 | kfree(rc_state); | |
193 | return ret; | 197 | return ret; |
194 | } | 198 | } |
195 | 199 | ||
@@ -339,13 +343,19 @@ static int m920x_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pid, in | |||
339 | static int m920x_firmware_download(struct usb_device *udev, const struct firmware *fw) | 343 | static int m920x_firmware_download(struct usb_device *udev, const struct firmware *fw) |
340 | { | 344 | { |
341 | u16 value, index, size; | 345 | u16 value, index, size; |
342 | u8 read[4], *buff; | 346 | u8 *read, *buff; |
343 | int i, pass, ret = 0; | 347 | int i, pass, ret = 0; |
344 | 348 | ||
345 | buff = kmalloc(65536, GFP_KERNEL); | 349 | buff = kmalloc(65536, GFP_KERNEL); |
346 | if (buff == NULL) | 350 | if (buff == NULL) |
347 | return -ENOMEM; | 351 | return -ENOMEM; |
348 | 352 | ||
353 | read = kmalloc(4, GFP_KERNEL); | ||
354 | if (!read) { | ||
355 | kfree(buff); | ||
356 | return -ENOMEM; | ||
357 | } | ||
358 | |||
349 | if ((ret = m920x_read(udev, M9206_FILTER, 0x0, 0x8000, read, 4)) != 0) | 359 | if ((ret = m920x_read(udev, M9206_FILTER, 0x0, 0x8000, read, 4)) != 0) |
350 | goto done; | 360 | goto done; |
351 | deb("%x %x %x %x\n", read[0], read[1], read[2], read[3]); | 361 | deb("%x %x %x %x\n", read[0], read[1], read[2], read[3]); |
@@ -396,6 +406,7 @@ static int m920x_firmware_download(struct usb_device *udev, const struct firmwar | |||
396 | deb("firmware uploaded!\n"); | 406 | deb("firmware uploaded!\n"); |
397 | 407 | ||
398 | done: | 408 | done: |
409 | kfree(read); | ||
399 | kfree(buff); | 410 | kfree(buff); |
400 | 411 | ||
401 | return ret; | 412 | return ret; |