On Fri, Jan 28, 2011 at 6:23 PM, Marek Szyprowski
<m.szyprowski@xxxxxxxxxxx> wrote:
Some UDC drivers fails to queue a request if req->buf == NULL even for
ZLP requests. This patch add support for dummy request buffer in case of
ZLP request.
diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c
@@ -356,6 +356,7 @@ static void ffs_ep0_complete(struct usb_ep *ep,
struct usb_request *req)
complete_all(&ffs->ep0req_completion);
}
+static char ffs_tmp_buf[1];
static int __ffs_ep0_queue_wait(struct ffs_data *ffs, char *data,
size_t len)
{
struct usb_request *req = ffs->ep0req;
@@ -368,6 +369,10 @@ static int __ffs_ep0_queue_wait(struct ffs_data
*ffs, char *data, size_t len)
req->buf = data;
req->length = len;
+ /* UDC layer require to provide a buffer even for ZLP */
+ if (req->buf == NULL)
+ req->buf = ffs_tmp_buf;
On Fri, 28 Jan 2011 10:30:26 +0100, Jassi Brar <jassisinghbrar@xxxxxxxxx>
wrote:
For ZLP the buffer is not supposed to be touched.
A driver may not accept req with NULL buf, but it _must_ not use the buf.
So, we'd better poison the buf so that we can catch buggy code.
Something like :-
> + if (req->buf == NULL)
+ req->buf = 0xdeadbabe;
Yeah, that looks reasonable as well.
--
Best regards, _ _
.o. | Liege of Serenly Enlightened Majesty of o' \,=./ `o
..o | Computer Science, Michal "mina86" Nazarewicz (o o)
ooo +-<email/jid: mnazarewicz@xxxxxxxxxx>--------ooO--(_)--Ooo--
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html