diff options
Diffstat (limited to 'drivers/usb/gadget/f_ncm.c')
-rw-r--r-- | drivers/usb/gadget/f_ncm.c | 32 |
1 files changed, 8 insertions, 24 deletions
diff --git a/drivers/usb/gadget/f_ncm.c b/drivers/usb/gadget/f_ncm.c index 424fc3d1cc36..326d7e6c297c 100644 --- a/drivers/usb/gadget/f_ncm.c +++ b/drivers/usb/gadget/f_ncm.c | |||
@@ -1208,30 +1208,18 @@ ncm_bind(struct usb_configuration *c, struct usb_function *f) | |||
1208 | ncm->notify_req->context = ncm; | 1208 | ncm->notify_req->context = ncm; |
1209 | ncm->notify_req->complete = ncm_notify_complete; | 1209 | ncm->notify_req->complete = ncm_notify_complete; |
1210 | 1210 | ||
1211 | /* copy descriptors, and track endpoint copies */ | ||
1212 | f->descriptors = usb_copy_descriptors(ncm_fs_function); | ||
1213 | if (!f->descriptors) | ||
1214 | goto fail; | ||
1215 | |||
1216 | /* | 1211 | /* |
1217 | * support all relevant hardware speeds... we expect that when | 1212 | * support all relevant hardware speeds... we expect that when |
1218 | * hardware is dual speed, all bulk-capable endpoints work at | 1213 | * hardware is dual speed, all bulk-capable endpoints work at |
1219 | * both speeds | 1214 | * both speeds |
1220 | */ | 1215 | */ |
1221 | if (gadget_is_dualspeed(c->cdev->gadget)) { | 1216 | hs_ncm_in_desc.bEndpointAddress = fs_ncm_in_desc.bEndpointAddress; |
1222 | hs_ncm_in_desc.bEndpointAddress = | 1217 | hs_ncm_out_desc.bEndpointAddress = fs_ncm_out_desc.bEndpointAddress; |
1223 | fs_ncm_in_desc.bEndpointAddress; | 1218 | hs_ncm_notify_desc.bEndpointAddress = |
1224 | hs_ncm_out_desc.bEndpointAddress = | 1219 | fs_ncm_notify_desc.bEndpointAddress; |
1225 | fs_ncm_out_desc.bEndpointAddress; | ||
1226 | hs_ncm_notify_desc.bEndpointAddress = | ||
1227 | fs_ncm_notify_desc.bEndpointAddress; | ||
1228 | |||
1229 | /* copy descriptors, and track endpoint copies */ | ||
1230 | f->hs_descriptors = usb_copy_descriptors(ncm_hs_function); | ||
1231 | if (!f->hs_descriptors) | ||
1232 | goto fail; | ||
1233 | } | ||
1234 | 1220 | ||
1221 | status = usb_assign_descriptors(f, ncm_fs_function, ncm_hs_function, | ||
1222 | NULL); | ||
1235 | /* | 1223 | /* |
1236 | * NOTE: all that is done without knowing or caring about | 1224 | * NOTE: all that is done without knowing or caring about |
1237 | * the network link ... which is unavailable to this code | 1225 | * the network link ... which is unavailable to this code |
@@ -1248,9 +1236,7 @@ ncm_bind(struct usb_configuration *c, struct usb_function *f) | |||
1248 | return 0; | 1236 | return 0; |
1249 | 1237 | ||
1250 | fail: | 1238 | fail: |
1251 | if (f->descriptors) | 1239 | usb_free_all_descriptors(f); |
1252 | usb_free_descriptors(f->descriptors); | ||
1253 | |||
1254 | if (ncm->notify_req) { | 1240 | if (ncm->notify_req) { |
1255 | kfree(ncm->notify_req->buf); | 1241 | kfree(ncm->notify_req->buf); |
1256 | usb_ep_free_request(ncm->notify, ncm->notify_req); | 1242 | usb_ep_free_request(ncm->notify, ncm->notify_req); |
@@ -1276,9 +1262,7 @@ ncm_unbind(struct usb_configuration *c, struct usb_function *f) | |||
1276 | 1262 | ||
1277 | DBG(c->cdev, "ncm unbind\n"); | 1263 | DBG(c->cdev, "ncm unbind\n"); |
1278 | 1264 | ||
1279 | if (gadget_is_dualspeed(c->cdev->gadget)) | 1265 | usb_free_all_descriptors(f); |
1280 | usb_free_descriptors(f->hs_descriptors); | ||
1281 | usb_free_descriptors(f->descriptors); | ||
1282 | 1266 | ||
1283 | kfree(ncm->notify_req->buf); | 1267 | kfree(ncm->notify_req->buf); |
1284 | usb_ep_free_request(ncm->notify, ncm->notify_req); | 1268 | usb_ep_free_request(ncm->notify, ncm->notify_req); |