[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <50AF7EB7.5070701@pengutronix.de>
Date: Fri, 23 Nov 2012 14:48:39 +0100
From: Marc Kleine-Budde <mkl@...gutronix.de>
To: Olivier Sobrie <olivier@...rie.be>
CC: linux-can@...r.kernel.org, Wolfgang Grandegge <wg@...ndegger.com>,
netdev@...r.kernel.org, linux-usb@...r.kernel.org
Subject: Re: [PATCH] kvaser_usb: fix "dma on the stack" errors
On 11/23/2012 02:40 PM, Olivier Sobrie wrote:
> On Fri, Nov 23, 2012 at 02:30:28PM +0100, Olivier Sobrie wrote:
>> The dma buffer given to usb_bulk_msg() must be allocated and not on
>> the stack.
>> See Documentation/DMA-API-HOWTO.txt section "What memory is DMA'able?"
>>
>> Signed-off-by: Olivier Sobrie <olivier@...rie.be>
>> ---
>> Here is the incremental patch.
>> Thank you Greg !
>>
>> Olivier
>>
>> drivers/net/can/usb/kvaser_usb.c | 110 ++++++++++++++++++++++++--------------
>> 1 file changed, 69 insertions(+), 41 deletions(-)
>>
>> diff --git a/drivers/net/can/usb/kvaser_usb.c b/drivers/net/can/usb/kvaser_usb.c
>> index 8807bf8..7ac6e82 100644
>> --- a/drivers/net/can/usb/kvaser_usb.c
>> +++ b/drivers/net/can/usb/kvaser_usb.c
>> @@ -421,14 +421,21 @@ end:
>> static int kvaser_usb_send_simple_msg(const struct kvaser_usb *dev,
>> u8 msg_id, int channel)
>> {
>> - struct kvaser_msg msg = {
>> - .len = MSG_HEADER_LEN + sizeof(struct kvaser_msg_simple),
>> - .id = msg_id,
>> - .u.simple.channel = channel,
>> - .u.simple.tid = 0xff,
>> - };
>> -
>> - return kvaser_usb_send_msg(dev, &msg);
>> + struct kvaser_msg *msg;
>> + int rc;
>> +
>> + msg = kmalloc(sizeof(*msg), GFP_KERNEL);
>> + if (!msg)
>> + return -ENOMEM;
>> +
>
> Doh! I removed by mistake the line "msg->id = msg_id"... grr
Please send a v2 version of this patch with this problem fixed.
MarcMarc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
Download attachment "signature.asc" of type "application/pgp-signature" (262 bytes)
Powered by blists - more mailing lists