From: Florian Mickler <florian@mickler.org>
To: mchehab@infradead.org
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
js@linuxtv.org, tskd2@yahoo.co.jp, liplianin@me.by,
g.marco@freenet.de, aet@rasterburn.org, pb@linuxtv.org,
mkrufky@linuxtv.org, nick@nick-andrew.net, max@veneto.com,
janne-dvb@grunau.be, Florian Mickler <florian@mickler.org>
Subject: [PATCH 4/6] [media] dw2102: get rid of on-stack dma buffer
Date: Mon, 21 Mar 2011 19:33:44 +0100 [thread overview]
Message-ID: <1300732426-18958-5-git-send-email-florian@mickler.org> (raw)
In-Reply-To: <1300732426-18958-1-git-send-email-florian@mickler.org>
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>
---
drivers/media/dvb/dvb-usb/dw2102.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/media/dvb/dvb-usb/dw2102.c b/drivers/media/dvb/dvb-usb/dw2102.c
index 2c307ba..4c8ff39 100644
--- a/drivers/media/dvb/dvb-usb/dw2102.c
+++ b/drivers/media/dvb/dvb-usb/dw2102.c
@@ -101,12 +101,16 @@ static int dw210x_op_rw(struct usb_device *dev, u8 request, u16 value,
u16 index, u8 * data, u16 len, int flags)
{
int ret;
- u8 u8buf[len];
-
+ u8 *u8buf;
unsigned int pipe = (flags == DW210X_READ_MSG) ?
usb_rcvctrlpipe(dev, 0) : usb_sndctrlpipe(dev, 0);
u8 request_type = (flags == DW210X_READ_MSG) ? USB_DIR_IN : USB_DIR_OUT;
+ u8buf = kmalloc(len, GFP_KERNEL);
+ if (!u8buf)
+ return -ENOMEM;
+
+
if (flags == DW210X_WRITE_MSG)
memcpy(u8buf, data, len);
ret = usb_control_msg(dev, pipe, request, request_type | USB_TYPE_VENDOR,
@@ -114,6 +118,8 @@ static int dw210x_op_rw(struct usb_device *dev, u8 request, u16 value,
if (flags == DW210X_READ_MSG)
memcpy(data, u8buf, len);
+
+ kfree(u8buf);
return ret;
}
--
1.7.4.1
next prev parent reply other threads:[~2011-03-21 18:34 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-21 18:33 [PATCH 0/6] get rid of on-stack dma buffers Florian Mickler
2011-03-21 18:33 ` [PATCH 1/6] [media] a800: " Florian Mickler
2011-03-21 18:33 ` [PATCH 2/6 v2] [media] vp7045: " Florian Mickler
2011-03-21 18:33 ` [PATCH 3/6] [media] friio: " Florian Mickler
2011-03-21 18:33 ` Florian Mickler [this message]
2011-03-21 18:33 ` [PATCH 5/6] [media] m920x: " Florian Mickler
2011-03-21 18:33 ` [PATCH 6/6] [media] opera1: get rid of on-stack dma buffer Florian Mickler
2011-03-21 19:26 ` [PATCH 0/6] get rid of on-stack dma buffers Andy Walls
2011-03-21 21:03 ` Florian Mickler
2011-03-22 10:44 ` Roedel, Joerg
[not found] ` <AANLkTimXobrwc-XHgoVN1dD5NCTde64dykbyvtJMo229@mail.gmail.com>
2011-03-22 13:12 ` Oliver Neukum
2011-03-22 14:27 ` Florian Mickler
2011-03-22 10:59 ` Jiri Kosina
2011-03-22 12:33 ` Johannes Stezenbach
2011-03-22 13:35 ` James Bottomley
2011-03-22 14:02 ` Florian Mickler
2011-03-22 20:15 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1300732426-18958-5-git-send-email-florian@mickler.org \
--to=florian@mickler.org \
--cc=aet@rasterburn.org \
--cc=g.marco@freenet.de \
--cc=janne-dvb@grunau.be \
--cc=js@linuxtv.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=liplianin@me.by \
--cc=max@veneto.com \
--cc=mchehab@infradead.org \
--cc=mkrufky@linuxtv.org \
--cc=nick@nick-andrew.net \
--cc=pb@linuxtv.org \
--cc=tskd2@yahoo.co.jp \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®