Changeset 63a3276 in mainline for uspace/srv/devman/driver.c
- Timestamp:
- 2019-08-06T19:20:35Z (6 years ago)
- Children:
- 3f05ef7
- Parents:
- 72c8f77
- git-author:
- Michal Koutný <xm.koutny+hos@…> (2015-06-17 23:02:03)
- git-committer:
- Matthieu Riolo <matthieu.riolo@…> (2019-08-06 19:20:35)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/devman/driver.c
r72c8f77 r63a3276 186 186 187 187 return drv_cnt; 188 } 189 190 /** Get name of unit that represents the driver 191 * 192 * @param[in] drv 193 * @param[out] unit_name_ptr should be free'd after use, not touched on fail 194 * 195 * @return EOK on success 196 * @return ENOMEM 197 */ 198 errno_t driver_unit_name(driver_t *drv, char **unit_name_ptr) 199 { 200 char *unit_name = NULL; 201 asprintf(&unit_name, "%s%c%s", drv->name, UNIT_NAME_SEPARATOR, 202 UNIT_SVC_TYPE_NAME); 203 204 if (unit_name == NULL) { 205 return ENOMEM; 206 } else { 207 *unit_name_ptr = unit_name; 208 return EOK; 209 } 188 210 } 189 211 … … 320 342 321 343 char *unit_name = NULL; 322 asprintf(&unit_name, "%s%c%s", drv->name, UNIT_NAME_SEPARATOR, 323 UNIT_SVC_TYPE_NAME); 324 if (unit_name == NULL) { 344 if (driver_unit_name(drv, &unit_name) != EOK) { 325 345 return false; 326 346 } … … 333 353 int flags = 0; 334 354 rc = sysman_unit_start(unit_name, flags); 355 free(unit_name); 335 356 336 357 if (rc != EOK) { … … 338 359 "Request to start driver `%s' failed: %s.", 339 360 drv->name, str_error(rc)); 340 free(unit_name);341 361 return false; 342 362 } 343 363 344 364 drv->state = DRIVER_STARTING; 345 free(unit_name);346 365 return true; 347 366 }
Note:
See TracChangeset
for help on using the changeset viewer.