Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 200688
b: refs/heads/master
c: e5fd39d
h: refs/heads/master
v: v3
  • Loading branch information
Michal Nazarewicz authored and Greg Kroah-Hartman committed Jun 30, 2010
1 parent 1940b19 commit 09bd1f2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 23 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c0f1f8e38fda8e345cad9269c559b4f036378120
refs/heads/master: e5fd39d9b80aaa0b8a16dd570fa55009905d6af4
34 changes: 12 additions & 22 deletions trunk/drivers/usb/gadget/f_mass_storage.c
Original file line number Diff line number Diff line change
Expand Up @@ -2970,7 +2970,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;

Expand All @@ -2996,23 +2995,29 @@ 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))
return -ENOMEM;

if (gadget_is_dualspeed(gadget)) {
/* Assume endpoint addresses are the same for both speeds */
fsg_hs_bulk_in_desc.bEndpointAddress =
fsg_fs_bulk_in_desc.bEndpointAddress;
fsg_hs_bulk_out_desc.bEndpointAddress =
fsg_fs_bulk_out_desc.bEndpointAddress;
f->hs_descriptors = usb_copy_descriptors(fsg_hs_function);
if (unlikely(!f->hs_descriptors))
if (unlikely(!f->hs_descriptors)) {
usb_free_descriptors(f->descriptors);
return -ENOMEM;
}
}

return 0;

autoconf_fail:
ERROR(fsg, "unable to autoconfigure all endpoints\n");
rc = -ENOTSUPP;
return rc;
return -ENOTSUPP;
}


Expand All @@ -3036,11 +3041,6 @@ static int fsg_add(struct usb_composite_dev *cdev,

fsg->function.name = FSG_DRIVER_DESC;
fsg->function.strings = fsg_strings_array;
fsg->function.descriptors = usb_copy_descriptors(fsg_fs_function);
if (unlikely(!fsg->function.descriptors)) {
rc = -ENOMEM;
goto error_free_fsg;
}
fsg->function.bind = fsg_bind;
fsg->function.unbind = fsg_unbind;
fsg->function.setup = fsg_setup;
Expand All @@ -3056,19 +3056,9 @@ static int fsg_add(struct usb_composite_dev *cdev,

rc = usb_add_function(c, &fsg->function);
if (unlikely(rc))
goto error_free_all;

fsg_common_get(fsg->common);
return 0;

error_free_all:
usb_free_descriptors(fsg->function.descriptors);
/* fsg_bind() might have copied those; or maybe not? who cares
* -- free it just in case. */
usb_free_descriptors(fsg->function.hs_descriptors);
error_free_fsg:
kfree(fsg);

kfree(fsg);
else
fsg_common_get(fsg->common);
return rc;
}

Expand Down

0 comments on commit 09bd1f2

Please sign in to comment.