Changes in uspace/drv/bus/usb/usbmid/usbmid.c [87a3df7f:feeac0d] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/usbmid/usbmid.c
r87a3df7f rfeeac0d 30 30 * @{ 31 31 */ 32 33 /* XXX Fix this */ 34 #define _DDF_DATA_IMPLANT 32 35 33 36 /** … … 99 102 const usb_standard_interface_descriptor_t *interface_descriptor) 100 103 { 104 ddf_fun_t *child = NULL; 101 105 char *child_name = NULL; 102 106 int rc; … … 110 114 usb_str_class(interface_descriptor->interface_class), 111 115 interface_descriptor->interface_number); 112 if (rc < 0) 116 if (rc < 0) { 113 117 return ENOMEM; 118 } 114 119 115 rc = ddf_fun_set_name(iface->fun, child_name); 120 /* Create the device. */ 121 child = ddf_fun_create(parent->ddf_dev, fun_inner, child_name); 116 122 free(child_name); 117 if ( rc != EOK)123 if (child == NULL) { 118 124 return ENOMEM; 125 } 119 126 120 127 match_id_list_t match_ids; … … 123 130 rc = usb_device_create_match_ids_from_interface(device_descriptor, 124 131 interface_descriptor, &match_ids); 125 if (rc != EOK) 132 if (rc != EOK) { 133 ddf_fun_destroy(child); 126 134 return rc; 135 } 127 136 128 137 list_foreach(match_ids.ids, link, match_id_t, match_id) { 129 rc = ddf_fun_add_match_id( iface->fun, match_id->id, match_id->score);138 rc = ddf_fun_add_match_id(child, match_id->id, match_id->score); 130 139 if (rc != EOK) { 131 140 clean_match_ids(&match_ids); 141 ddf_fun_destroy(child); 132 142 return rc; 133 143 } … … 135 145 clean_match_ids(&match_ids); 136 146 137 ddf_fun_set_ops(iface->fun, &child_device_ops); 147 rc = ddf_fun_bind(child); 148 if (rc != EOK) { 149 /* This takes care of match_id deallocation as well. */ 150 ddf_fun_destroy(child); 151 return rc; 152 } 138 153 139 rc = ddf_fun_bind(iface->fun);140 if (rc != EOK)141 return rc;154 iface->fun = child; 155 ddf_fun_data_implant(child, iface); 156 ddf_fun_set_ops(child, &child_device_ops); 142 157 143 158 return EOK;
Note:
See TracChangeset
for help on using the changeset viewer.