diff options
Diffstat (limited to 'drivers/usb/gadget/file_storage.c')
-rw-r--r-- | drivers/usb/gadget/file_storage.c | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c index 7e650d015585..8712ef987179 100644 --- a/drivers/usb/gadget/file_storage.c +++ b/drivers/usb/gadget/file_storage.c | |||
@@ -3733,19 +3733,12 @@ static void /* __init_or_exit */ fsg_unbind(struct usb_gadget *gadget) | |||
3733 | } | 3733 | } |
3734 | 3734 | ||
3735 | /* Free the data buffers */ | 3735 | /* Free the data buffers */ |
3736 | for (i = 0; i < NUM_BUFFERS; ++i) { | 3736 | for (i = 0; i < NUM_BUFFERS; ++i) |
3737 | struct fsg_buffhd *bh = &fsg->buffhds[i]; | 3737 | kfree(fsg->buffhds[i].buf); |
3738 | |||
3739 | if (bh->buf) | ||
3740 | usb_ep_free_buffer(fsg->bulk_in, bh->buf, bh->dma, | ||
3741 | mod_data.buflen); | ||
3742 | } | ||
3743 | 3738 | ||
3744 | /* Free the request and buffer for endpoint 0 */ | 3739 | /* Free the request and buffer for endpoint 0 */ |
3745 | if (req) { | 3740 | if (req) { |
3746 | if (req->buf) | 3741 | kfree(req->buf); |
3747 | usb_ep_free_buffer(fsg->ep0, req->buf, | ||
3748 | req->dma, EP0_BUFSIZE); | ||
3749 | usb_ep_free_request(fsg->ep0, req); | 3742 | usb_ep_free_request(fsg->ep0, req); |
3750 | } | 3743 | } |
3751 | 3744 | ||
@@ -3972,8 +3965,7 @@ static int __init fsg_bind(struct usb_gadget *gadget) | |||
3972 | fsg->ep0req = req = usb_ep_alloc_request(fsg->ep0, GFP_KERNEL); | 3965 | fsg->ep0req = req = usb_ep_alloc_request(fsg->ep0, GFP_KERNEL); |
3973 | if (!req) | 3966 | if (!req) |
3974 | goto out; | 3967 | goto out; |
3975 | req->buf = usb_ep_alloc_buffer(fsg->ep0, EP0_BUFSIZE, | 3968 | req->buf = kmalloc(EP0_BUFSIZE, GFP_KERNEL); |
3976 | &req->dma, GFP_KERNEL); | ||
3977 | if (!req->buf) | 3969 | if (!req->buf) |
3978 | goto out; | 3970 | goto out; |
3979 | req->complete = ep0_complete; | 3971 | req->complete = ep0_complete; |
@@ -3985,8 +3977,7 @@ static int __init fsg_bind(struct usb_gadget *gadget) | |||
3985 | /* Allocate for the bulk-in endpoint. We assume that | 3977 | /* Allocate for the bulk-in endpoint. We assume that |
3986 | * the buffer will also work with the bulk-out (and | 3978 | * the buffer will also work with the bulk-out (and |
3987 | * interrupt-in) endpoint. */ | 3979 | * interrupt-in) endpoint. */ |
3988 | bh->buf = usb_ep_alloc_buffer(fsg->bulk_in, mod_data.buflen, | 3980 | bh->buf = kmalloc(mod_data.buflen, GFP_KERNEL); |
3989 | &bh->dma, GFP_KERNEL); | ||
3990 | if (!bh->buf) | 3981 | if (!bh->buf) |
3991 | goto out; | 3982 | goto out; |
3992 | bh->next = bh + 1; | 3983 | bh->next = bh + 1; |