On 11/23/2012 02:40 PM, Olivier Sobrie wrote:
On Fri, Nov 23, 2012 at 02:30:28PM +0100, Olivier Sobrie wrote:
quoted
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 <redacted>
---
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 |