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. > > Signed-off-by: Marek Szyprowski <m.szyprowski@xxxxxxxxxxx> > Signed-off-by: Kyungmin Park <kyungmin.park@xxxxxxxxxxx> > --- > Âdrivers/usb/gadget/f_fs.c |  Â5 +++++ > Â1 files changed, 5 insertions(+), 0 deletions(-) > > diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c > index 1499f9e..f0a0907 100644 > --- 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; 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; -- 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