Changeset bab6388 in mainline for uspace/drv/pciintel/pci.c
- Timestamp:
- 2011-02-13T20:23:37Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 7df0477e
- Parents:
- 68414f4a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/pciintel/pci.c
r68414f4a rbab6388 111 111 pci_bus_t *bus; 112 112 113 bus = (pci_bus_t *) malloc(sizeof(pci_bus_t)); 114 if (bus != NULL) { 115 memset(bus, 0, sizeof(pci_bus_t)); 116 fibril_mutex_initialize(&bus->conf_mutex); 117 } 118 113 bus = (pci_bus_t *) calloc(1, sizeof(pci_bus_t)); 114 if (bus == NULL) 115 return NULL; 116 117 fibril_mutex_initialize(&bus->conf_mutex); 119 118 return bus; 120 119 } … … 122 121 static void pci_bus_delete(pci_bus_t *bus) 123 122 { 123 assert(bus != NULL); 124 124 free(bus); 125 125 } … … 228 228 add_match_id(&fun->fnode->match_ids, match_id); 229 229 } 230 230 231 231 /* TODO add more ids (with subsys ids, using class id etc.) */ 232 232 } … … 266 266 */ 267 267 int pci_read_bar(pci_fun_t *fun, int addr) 268 { 268 { 269 269 /* Value of the BAR */ 270 270 uint32_t val, mask; … … 369 369 bool multi; 370 370 uint8_t header_type; 371 371 372 372 /* We need this early, before registering. */ 373 373 fun->fnode = fnode; … … 485 485 async_hangup(dnode->parent_phone); 486 486 return rc; 487 } 487 } 488 488 489 489 printf(NAME ": conf_addr = %" PRIx64 ".\n", … … 531 531 pci_fun_t *pci_fun_new(void) 532 532 { 533 pci_fun_t *res = (pci_fun_t *) malloc(sizeof(pci_fun_t)); 534 535 if (res != NULL) 536 memset(res, 0, sizeof(pci_fun_t)); 533 pci_fun_t *res; 534 535 res = (pci_fun_t *) calloc(1, sizeof(pci_fun_t)); 537 536 return res; 538 537 } … … 547 546 void pci_fun_delete(pci_fun_t *fun) 548 547 { 549 if (fun != NULL) { 550 hw_res_clean_resource_list(&fun->hw_resources); 551 free(fun); 552 } 548 assert(fun != NULL); 549 hw_res_clean_resource_list(&fun->hw_resources); 550 free(fun); 553 551 } 554 552
Note:
See TracChangeset
for help on using the changeset viewer.