[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.44L0.1201191004540.1447-100000@iolanthe.rowland.org>
Date: Thu, 19 Jan 2012 10:07:45 -0500 (EST)
From: Alan Stern <stern@...land.harvard.edu>
To: Stephane Grosjean <s.grosjean@...k-system.com>
cc: Oliver Hartkopp <socketcan@...tkopp.net>,
linux-usb Mailing List <linux-usb@...r.kernel.org>,
netdev Mailing List <netdev@...r.kernel.org>,
linux-can Mailing List <linux-can@...r.kernel.org>
Subject: Re: [PATCH 2/3 V3.1] can/usb: PEAK-System Technik PCAN-USB specific
part
On Thu, 19 Jan 2012, Stephane Grosjean wrote:
> This patch adds the specific part which handles the PCAN-USB adapter from
> PEAK-System Technik (http://www.peak-system.com). The PCAN-USB adapter is
> a sja1000 based, mono-channel USB 1.1 adapter compliant with CAN
> specifications 2.0A (11-bit ID) and 2.0B (29-bit ID).
>
> V3.1: same as V3 + add linux-can in cc:
> +/*
> + * send a command
> + */
> +static int pcan_usb_send_cmd(struct peak_usb_device *dev, u8 f, u8 n, u8 *p)
> +{
> + int err;
> + int actual_length;
> + struct pcan_usb_parameter cmd = {
> + .function = f,
> + .number = n,
> + };
> +
> + /* usb device unregistered? */
> + if (!(dev->state & PCAN_USB_STATE_CONNECTED))
> + return 0;
> +
> + if (p)
> + memcpy(cmd.parameters, p, ARRAY_SIZE(cmd.parameters));
> +
> + err = usb_bulk_msg(dev->udev,
> + usb_sndbulkpipe(dev->udev, PCAN_USB_EP_CMDOUT), &cmd,
> + sizeof(struct pcan_usb_parameter), &actual_length,
> + PCAN_USB_COMMAND_TIMEOUT);
Here, and in several other places in this patch series, you submit
requests using a transfer buffer that is allocated on the stack. This
is forbidden because not all platforms can do DMA to stack or static
addresses. The transfer buffers should be allocated dynamically.
Alan Stern
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists