The Linux Kernel Mailing List
 help / color / mirror / Atom feed
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 1/6] [media] a800: get rid of on-stack dma buffers
Date: Mon, 21 Mar 2011 19:33:41 +0100	[thread overview]
Message-ID: <1300732426-18958-2-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/a800.c |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/drivers/media/dvb/dvb-usb/a800.c b/drivers/media/dvb/dvb-usb/a800.c
index 53b93a4..fe2366b 100644
--- a/drivers/media/dvb/dvb-usb/a800.c
+++ b/drivers/media/dvb/dvb-usb/a800.c
@@ -78,17 +78,26 @@ static struct rc_map_table rc_map_a800_table[] = {
 
 static int a800_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
 {
-	u8 key[5];
+	int ret;
+	u8 *key = kmalloc(5, GFP_KERNEL);
+	if (!key)
+		return -ENOMEM;
+
 	if (usb_control_msg(d->udev,usb_rcvctrlpipe(d->udev,0),
 				0x04, USB_TYPE_VENDOR | USB_DIR_IN, 0, 0, key, 5,
-				2000) != 5)
-		return -ENODEV;
+				2000) != 5) {
+		ret = -ENODEV;
+		goto out;
+	}
 
 	/* call the universal NEC remote processor, to find out the key's state and event */
 	dvb_usb_nec_rc_key_to_event(d,key,event,state);
 	if (key[0] != 0)
 		deb_rc("key: %x %x %x %x %x\n",key[0],key[1],key[2],key[3],key[4]);
-	return 0;
+	ret = 0;
+out:
+	kfree(key);
+	return ret;
 }
 
 /* USB Driver stuff */
-- 
1.7.4.1


  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 ` Florian Mickler [this message]
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 ` [PATCH 4/6] [media] dw2102: get rid of on-stack dma buffer Florian Mickler
2011-03-21 18:33 ` [PATCH 5/6] [media] m920x: get rid of on-stack dma buffers 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-2-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