Changeset 8304889 in mainline
- Timestamp:
- 2010-10-23T17:51:33Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- d93aafed
- Parents:
- 713a4b9
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/pciintel/pci.c
r713a4b9 r8304889 65 65 pci_dev_data_t *dev_data = (pci_dev_data_t *) dev->driver_data; 66 66 67 if ( NULL == dev_data)67 if (dev_data == NULL) 68 68 return NULL; 69 69 return &dev_data->hw_resources; … … 109 109 110 110 bus_data = (pci_bus_data_t *) malloc(sizeof(pci_bus_data_t)); 111 if ( NULL != bus_data) {111 if (bus_data != NULL) { 112 112 memset(bus_data, 0, sizeof(pci_bus_data_t)); 113 113 fibril_mutex_initialize(&bus_data->conf_mutex); 114 114 } 115 115 116 return bus_data; 116 117 } … … 123 124 static void pci_conf_read(device_t *dev, int reg, uint8_t *buf, size_t len) 124 125 { 125 assert( NULL != dev->parent);126 assert(dev->parent != NULL); 126 127 127 128 pci_dev_data_t *dev_data = (pci_dev_data_t *) dev->driver_data; … … 153 154 static void pci_conf_write(device_t *dev, int reg, uint8_t *buf, size_t len) 154 155 { 155 assert( NULL != dev->parent);156 assert(dev->parent != NULL); 156 157 157 158 pci_dev_data_t *dev_data = (pci_dev_data_t *) dev->driver_data; … … 224 225 225 226 match_id = create_match_id(); 226 if ( NULL != match_id) {227 if (match_id != NULL) { 227 228 asprintf(&match_id_str, "pci/ven=%04x&dev=%04x", 228 229 dev_data->vendor_id, dev_data->device_id); … … 230 231 match_id->score = 90; 231 232 add_match_id(&dev->match_ids, match_id); 232 } 233 } 234 233 235 /* TODO add more ids (with subsys ids, using class id etc.) */ 234 236 } … … 242 244 size_t count = hw_res_list->count; 243 245 244 assert( NULL != hw_resources);246 assert(hw_resources != NULL); 245 247 assert(count < PCI_MAX_HW_RES); 246 248 … … 354 356 { 355 357 uint8_t irq = pci_conf_read_8(dev, PCI_BRIDGE_INT_LINE); 356 if ( 0xff != irq)358 if (irq != 0xff) 357 359 pci_add_interrupt(dev, irq); 358 360 } … … 415 417 create_pci_match_ids(dev); 416 418 417 if ( EOK != child_device_register(dev, parent)) {419 if (child_device_register(dev, parent) != EOK) { 418 420 pci_clean_resource_list(dev); 419 421 clean_match_ids(&dev->match_ids); … … 424 426 425 427 if (header_type == PCI_HEADER_TYPE_BRIDGE || 426 header_type == PCI_HEADER_TYPE_CARDBUS 428 header_type == PCI_HEADER_TYPE_CARDBUS) { 427 429 child_bus = pci_conf_read_8(dev, 428 430 PCI_BRIDGE_SEC_BUS_NUM); 429 431 printf(NAME ": device is pci-to-pci bridge, " 430 432 "secondary bus number = %d.\n", bus_num); 431 if (child_bus > bus_num)433 if (child_bus > bus_num) 432 434 pci_bus_scan(parent, child_bus); 433 435 } … … 453 455 454 456 pci_bus_data_t *bus_data = create_pci_bus_data(); 455 if ( NULL == bus_data) {457 if (bus_data == NULL) { 456 458 printf(NAME ": pci_add_device allocation failed.\n"); 457 459 return ENOMEM; … … 517 519 pci_dev_data_t *res = (pci_dev_data_t *) malloc(sizeof(pci_dev_data_t)); 518 520 519 if ( NULL != res)521 if (res != NULL) 520 522 memset(res, 0, sizeof(pci_dev_data_t)); 521 523 return res; … … 531 533 void delete_pci_dev_data(pci_dev_data_t *d) 532 534 { 533 if ( NULL != d) {535 if (d != NULL) { 534 536 clean_hw_resource_list(&d->hw_resources); 535 537 free(d); … … 560 562 pci_dev_data_t *dev_data = (pci_dev_data_t *) dev->driver_data; 561 563 562 if ( NULL != dev_data->hw_resources.resources) {564 if (dev_data->hw_resources.resources != NULL) { 563 565 free(dev_data->hw_resources.resources); 564 566 dev_data->hw_resources.resources = NULL;
Note:
See TracChangeset
for help on using the changeset viewer.