diff options
Diffstat (limited to 'drivers/usb/gadget/f_ecm.c')
-rw-r--r-- | drivers/usb/gadget/f_ecm.c | 42 |
1 files changed, 9 insertions, 33 deletions
diff --git a/drivers/usb/gadget/f_ecm.c b/drivers/usb/gadget/f_ecm.c index 2d3c5a46de8e..83420a310fb7 100644 --- a/drivers/usb/gadget/f_ecm.c +++ b/drivers/usb/gadget/f_ecm.c | |||
@@ -354,7 +354,7 @@ static struct usb_descriptor_header *ecm_ss_function[] = { | |||
354 | 354 | ||
355 | static struct usb_string ecm_string_defs[] = { | 355 | static struct usb_string ecm_string_defs[] = { |
356 | [0].s = "CDC Ethernet Control Model (ECM)", | 356 | [0].s = "CDC Ethernet Control Model (ECM)", |
357 | [1].s = NULL /* DYNAMIC */, | 357 | [1].s = "", |
358 | [2].s = "CDC Ethernet Data", | 358 | [2].s = "CDC Ethernet Data", |
359 | [3].s = "CDC ECM", | 359 | [3].s = "CDC ECM", |
360 | { } /* end of list */ | 360 | { } /* end of list */ |
@@ -803,12 +803,11 @@ ecm_unbind(struct usb_configuration *c, struct usb_function *f) | |||
803 | 803 | ||
804 | DBG(c->cdev, "ecm unbind\n"); | 804 | DBG(c->cdev, "ecm unbind\n"); |
805 | 805 | ||
806 | ecm_string_defs[0].id = 0; | ||
806 | usb_free_all_descriptors(f); | 807 | usb_free_all_descriptors(f); |
807 | 808 | ||
808 | kfree(ecm->notify_req->buf); | 809 | kfree(ecm->notify_req->buf); |
809 | usb_ep_free_request(ecm->notify, ecm->notify_req); | 810 | usb_ep_free_request(ecm->notify, ecm->notify_req); |
810 | |||
811 | ecm_string_defs[1].s = NULL; | ||
812 | kfree(ecm); | 811 | kfree(ecm); |
813 | } | 812 | } |
814 | 813 | ||
@@ -833,36 +832,15 @@ ecm_bind_config(struct usb_configuration *c, u8 ethaddr[ETH_ALEN]) | |||
833 | if (!can_support_ecm(c->cdev->gadget) || !ethaddr) | 832 | if (!can_support_ecm(c->cdev->gadget) || !ethaddr) |
834 | return -EINVAL; | 833 | return -EINVAL; |
835 | 834 | ||
836 | /* maybe allocate device-global string IDs */ | ||
837 | if (ecm_string_defs[0].id == 0) { | 835 | if (ecm_string_defs[0].id == 0) { |
838 | 836 | status = usb_string_ids_tab(c->cdev, ecm_string_defs); | |
839 | /* control interface label */ | 837 | if (status) |
840 | status = usb_string_id(c->cdev); | ||
841 | if (status < 0) | ||
842 | return status; | 838 | return status; |
843 | ecm_string_defs[0].id = status; | ||
844 | ecm_control_intf.iInterface = status; | ||
845 | 839 | ||
846 | /* data interface label */ | 840 | ecm_control_intf.iInterface = ecm_string_defs[0].id; |
847 | status = usb_string_id(c->cdev); | 841 | ecm_data_intf.iInterface = ecm_string_defs[2].id; |
848 | if (status < 0) | 842 | ecm_desc.iMACAddress = ecm_string_defs[1].id; |
849 | return status; | 843 | ecm_iad_descriptor.iFunction = ecm_string_defs[3].id; |
850 | ecm_string_defs[2].id = status; | ||
851 | ecm_data_intf.iInterface = status; | ||
852 | |||
853 | /* MAC address */ | ||
854 | status = usb_string_id(c->cdev); | ||
855 | if (status < 0) | ||
856 | return status; | ||
857 | ecm_string_defs[1].id = status; | ||
858 | ecm_desc.iMACAddress = status; | ||
859 | |||
860 | /* IAD label */ | ||
861 | status = usb_string_id(c->cdev); | ||
862 | if (status < 0) | ||
863 | return status; | ||
864 | ecm_string_defs[3].id = status; | ||
865 | ecm_iad_descriptor.iFunction = status; | ||
866 | } | 844 | } |
867 | 845 | ||
868 | /* allocate and initialize one new instance */ | 846 | /* allocate and initialize one new instance */ |
@@ -887,9 +865,7 @@ ecm_bind_config(struct usb_configuration *c, u8 ethaddr[ETH_ALEN]) | |||
887 | ecm->port.func.disable = ecm_disable; | 865 | ecm->port.func.disable = ecm_disable; |
888 | 866 | ||
889 | status = usb_add_function(c, &ecm->port.func); | 867 | status = usb_add_function(c, &ecm->port.func); |
890 | if (status) { | 868 | if (status) |
891 | ecm_string_defs[1].s = NULL; | ||
892 | kfree(ecm); | 869 | kfree(ecm); |
893 | } | ||
894 | return status; | 870 | return status; |
895 | } | 871 | } |