Changeset f527f58 in mainline for uspace/lib/usbhost/src/usb_bus.c
- Timestamp:
- 2016-08-03T11:12:24Z (9 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 96ef672
- Parents:
- e657635
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbhost/src/usb_bus.c
re657635 rf527f58 242 242 return EEXIST; 243 243 } 244 /* Add endpoint list's reference to ep. */ 245 endpoint_add_ref(ep); 244 246 list_append(&ep->link, get_list(instance, ep->address)); 245 247 … … 274 276 ep->endpoint, usb_str_transfer_type_short(ep->transfer_type), 275 277 usb_str_direction(ep->direction)); 278 /* Drop endpoint list's reference to ep. */ 279 endpoint_del_ref(ep); 276 280 fibril_mutex_unlock(&instance->guard); 277 281 return EOK; … … 289 293 fibril_mutex_lock(&instance->guard); 290 294 endpoint_t *ep = find_locked(instance, address, endpoint, direction); 295 if (ep) { 296 /* We are exporting ep to the outside world, add reference. */ 297 endpoint_add_ref(ep); 298 } 291 299 fibril_mutex_unlock(&instance->guard); 292 300 return ep; … … 350 358 } 351 359 360 /* Add our reference to ep. */ 361 endpoint_add_ref(ep); 362 352 363 if (callback) { 353 364 const int ret = callback(ep, arg); 354 365 if (ret != EOK) { 355 366 fibril_mutex_unlock(&instance->guard); 356 endpoint_de stroy(ep);367 endpoint_del_ref(ep); 357 368 return ret; 358 369 } 359 370 } 371 372 /* Add endpoint list's reference to ep. */ 373 endpoint_add_ref(ep); 360 374 list_append(&ep->link, get_list(instance, ep->address)); 361 375 362 376 instance->free_bw -= ep->bandwidth; 363 377 fibril_mutex_unlock(&instance->guard); 378 379 /* Drop our reference to ep. */ 380 endpoint_del_ref(ep); 381 364 382 return EOK; 365 383 } … … 392 410 callback(ep, arg); 393 411 } 394 endpoint_destroy(ep); 412 /* Drop endpoint list's reference to ep. */ 413 endpoint_del_ref(ep); 395 414 return EOK; 396 415 } … … 445 464 if (callback) 446 465 callback(ep, arg); 447 endpoint_destroy(ep); 466 /* Drop endpoint list's reference to ep. */ 467 endpoint_del_ref(ep); 448 468 } 449 469 }
Note:
See TracChangeset
for help on using the changeset viewer.