From f361b6ecc10b0b14e46fc2e1334ea0bad7d217d1 Mon Sep 17 00:00:00 2001 From: Michal Moskal Date: Wed, 26 Jul 2017 11:32:49 +0100 Subject: [PATCH] Apply https://github.com/torvalds/linux/commit/e5fd39d9b80aaa0b8a16dd570fa55009905d6af4 --- brick/kernel/f_mass_storage.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/brick/kernel/f_mass_storage.c b/brick/kernel/f_mass_storage.c index 9819dee2..e7eec04c 100644 --- a/brick/kernel/f_mass_storage.c +++ b/brick/kernel/f_mass_storage.c @@ -2965,7 +2965,6 @@ static int fsg_bind(struct usb_configuration *c, struct usb_function *f) { struct fsg_dev *fsg = fsg_from_func(f); struct usb_gadget *gadget = c->cdev->gadget; - int rc; int i; struct usb_ep *ep; @@ -2991,6 +2990,13 @@ static int fsg_bind(struct usb_configuration *c, struct usb_function *f) ep->driver_data = fsg->common; /* claim the endpoint */ fsg->bulk_out = ep; + /* Copy descriptors */ + f->descriptors = usb_copy_descriptors(fsg_fs_function); + if (unlikely(!f->descriptors)) { + usb_free_descriptors(f->descriptors); + return -ENOMEM; + } + if (gadget_is_dualspeed(gadget)) { /* Assume endpoint addresses are the same for both speeds */ fsg_hs_bulk_in_desc.bEndpointAddress = @@ -3004,9 +3010,8 @@ static int fsg_bind(struct usb_configuration *c, struct usb_function *f) autoconf_fail: ERROR(fsg, "unable to autoconfigure all endpoints\n"); - rc = -ENOTSUPP; fsg_unbind(c, f); - return rc; + return -ENOTSUPP; }