aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/file_storage.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/gadget/file_storage.c')
-rw-r--r--drivers/usb/gadget/file_storage.c22
1 files changed, 6 insertions, 16 deletions
diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c
index 4639b629e60c..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
@@ -3963,8 +3956,7 @@ static int __init fsg_bind(struct usb_gadget *gadget)
3963#endif 3956#endif
3964 3957
3965 if (gadget->is_otg) { 3958 if (gadget->is_otg) {
3966 otg_desc.bmAttributes |= USB_OTG_HNP, 3959 otg_desc.bmAttributes |= USB_OTG_HNP;
3967 config_desc.bmAttributes |= USB_CONFIG_ATT_WAKEUP;
3968 } 3960 }
3969 3961
3970 rc = -ENOMEM; 3962 rc = -ENOMEM;
@@ -3973,8 +3965,7 @@ static int __init fsg_bind(struct usb_gadget *gadget)
3973 fsg->ep0req = req = usb_ep_alloc_request(fsg->ep0, GFP_KERNEL); 3965 fsg->ep0req = req = usb_ep_alloc_request(fsg->ep0, GFP_KERNEL);
3974 if (!req) 3966 if (!req)
3975 goto out; 3967 goto out;
3976 req->buf = usb_ep_alloc_buffer(fsg->ep0, EP0_BUFSIZE, 3968 req->buf = kmalloc(EP0_BUFSIZE, GFP_KERNEL);
3977 &req->dma, GFP_KERNEL);
3978 if (!req->buf) 3969 if (!req->buf)
3979 goto out; 3970 goto out;
3980 req->complete = ep0_complete; 3971 req->complete = ep0_complete;
@@ -3986,8 +3977,7 @@ static int __init fsg_bind(struct usb_gadget *gadget)
3986 /* Allocate for the bulk-in endpoint. We assume that 3977 /* Allocate for the bulk-in endpoint. We assume that
3987 * the buffer will also work with the bulk-out (and 3978 * the buffer will also work with the bulk-out (and
3988 * interrupt-in) endpoint. */ 3979 * interrupt-in) endpoint. */
3989 bh->buf = usb_ep_alloc_buffer(fsg->bulk_in, mod_data.buflen, 3980 bh->buf = kmalloc(mod_data.buflen, GFP_KERNEL);
3990 &bh->dma, GFP_KERNEL);
3991 if (!bh->buf) 3981 if (!bh->buf)
3992 goto out; 3982 goto out;
3993 bh->next = bh + 1; 3983 bh->next = bh + 1;