Changeset bab6388 in mainline for uspace/drv/pciintel/pci.c


Ignore:
Timestamp:
2011-02-13T20:23:37Z (14 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7df0477e
Parents:
68414f4a
Message:

Small additional cleanup.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/pciintel/pci.c

    r68414f4a rbab6388  
    111111        pci_bus_t *bus;
    112112       
    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);
    119118        return bus;
    120119}
     
    122121static void pci_bus_delete(pci_bus_t *bus)
    123122{
     123        assert(bus != NULL);
    124124        free(bus);
    125125}
     
    228228                add_match_id(&fun->fnode->match_ids, match_id);
    229229        }
    230 
     230       
    231231        /* TODO add more ids (with subsys ids, using class id etc.) */
    232232}
     
    266266 */
    267267int pci_read_bar(pci_fun_t *fun, int addr)
    268 {       
     268{
    269269        /* Value of the BAR */
    270270        uint32_t val, mask;
     
    369369        bool multi;
    370370        uint8_t header_type;
    371 
     371       
    372372        /* We need this early, before registering. */
    373373        fun->fnode = fnode;
     
    485485                async_hangup(dnode->parent_phone);
    486486                return rc;
    487         }       
     487        }
    488488       
    489489        printf(NAME ": conf_addr = %" PRIx64 ".\n",
     
    531531pci_fun_t *pci_fun_new(void)
    532532{
    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));
    537536        return res;
    538537}
     
    547546void pci_fun_delete(pci_fun_t *fun)
    548547{
    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);
    553551}
    554552
Note: See TracChangeset for help on using the changeset viewer.