Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset ef9460b in mainline


Ignore:
Timestamp:
2011-07-14T21:55:18Z (10 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master
Children:
333c233
Parents:
159100a
Message:

ddf_fun_add_match_id() should copy its string argument.

Location:
uspace
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/isa/isa.c

    r159100a ref9460b  
    352352                    str_error(rc));
    353353        }
     354
     355        free(id);
    354356}
    355357
  • uspace/drv/bus/pci/pciintel/pci.c

    r159100a ref9460b  
    342342        }
    343343       
     344        free(match_id_str);
     345       
    344346        /* TODO add more ids (with subsys ids, using class id etc.) */
    345347}
  • uspace/drv/bus/usb/ohci/hc.c

    r159100a ref9460b  
    151151            "Failed to add OHCI root hub endpoint 0: %s.\n", str_error(ret));
    152152
    153         char *match_str = NULL;
    154         /* DDF needs heap allocated string. */
    155         ret = asprintf(&match_str, "usb&class=hub");
    156         ret = ret > 0 ? 0 : ret;
    157         CHECK_RET_RELEASE(ret,
    158             "Failed to create match-id string: %s.\n", str_error(ret));
    159 
    160         ret = ddf_fun_add_match_id(hub_fun, match_str, 100);
     153        ret = ddf_fun_add_match_id(hub_fun, "usb&class=hub", 100);
    161154        CHECK_RET_RELEASE(ret,
    162155            "Failed to add root hub match-id: %s.\n", str_error(ret));
  • uspace/drv/bus/usb/uhci/root_hub.c

    r159100a ref9460b  
    5050int rh_init(rh_t *instance, ddf_fun_t *fun, uintptr_t reg_addr, size_t reg_size)
    5151{
     52        int ret;
     53
    5254        assert(fun);
    5355
    54         char *match_str = NULL;
    55         int ret = asprintf(&match_str, "usb&uhci&root-hub");
    56         if (ret < 0) {
    57                 usb_log_error("Failed to create root hub match string: %s.\n",
    58                     str_error(ret));
    59                 return ret;
    60         }
    61         assert(match_str);
    62 
    63         ret = ddf_fun_add_match_id(fun, match_str, 100);
     56        ret = ddf_fun_add_match_id(fun, "usb&uhci&root-hub", 100);
    6457        if (ret != EOK) {
    65                 free(match_str);
    6658                usb_log_error("Failed to add root hub match id: %s\n",
    6759                    str_error(ret));
  • uspace/drv/infrastructure/root/root.c

    r159100a ref9460b  
    176176        }
    177177
     178        free(match_id);
     179
    178180        rc = ddf_fun_bind(fun);
    179181        if (rc != EOK) {
  • uspace/drv/test/test1/test1.c

    r159100a ref9460b  
    7474        }
    7575
    76         rc = ddf_fun_add_match_id(fun, str_dup(match_id), match_score);
     76        rc = ddf_fun_add_match_id(fun, match_id, match_score);
    7777        if (rc != EOK) {
    7878                ddf_msg(LVL_ERROR, "Failed adding match IDs to function %s",
  • uspace/lib/drv/generic/driver.c

    r159100a ref9460b  
    620620                return ENOMEM;
    621621       
    622         match_id->id = match_id_str;
     622        match_id->id = str_dup(match_id_str);
    623623        match_id->score = 90;
    624624       
Note: See TracChangeset for help on using the changeset viewer.