Changes in uspace/drv/test/test3/test3.c [267f235:b7fd2a0] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/test/test3/test3.c
r267f235 rb7fd2a0 41 41 #define NUM_FUNCS 20 42 42 43 static int test3_dev_add(ddf_dev_t *dev);44 static int test3_dev_remove(ddf_dev_t *dev);45 static int test3_fun_online(ddf_fun_t *fun);46 static int test3_fun_offline(ddf_fun_t *fun);43 static errno_t test3_dev_add(ddf_dev_t *dev); 44 static errno_t test3_dev_remove(ddf_dev_t *dev); 45 static errno_t test3_fun_online(ddf_fun_t *fun); 46 static errno_t test3_fun_offline(ddf_fun_t *fun); 47 47 48 48 static driver_ops_t driver_ops = { … … 63 63 } test3_t; 64 64 65 static int register_fun_and_add_to_category(ddf_dev_t *parent,65 static errno_t register_fun_and_add_to_category(ddf_dev_t *parent, 66 66 const char *base_name, size_t index, const char *class_name, 67 67 ddf_fun_t **pfun) 68 68 { 69 69 ddf_fun_t *fun = NULL; 70 int rc;70 errno_t rc; 71 71 char *fun_name = NULL; 72 72 73 rc = asprintf(&fun_name, "%s%zu", base_name, index);74 if (rc < 0) {75 ddf_msg(LVL_ERROR, "Failed to format string: %s", str_error(rc));73 if (asprintf(&fun_name, "%s%zu", base_name, index) < 0) { 74 ddf_msg(LVL_ERROR, "Failed to format string: No memory"); 75 rc = ENOMEM; 76 76 goto leave; 77 77 } … … 106 106 } 107 107 108 static int fun_remove(ddf_fun_t *fun, const char *name)108 static errno_t fun_remove(ddf_fun_t *fun, const char *name) 109 109 { 110 int rc;110 errno_t rc; 111 111 112 112 ddf_msg(LVL_DEBUG, "fun_remove(%p, '%s')", fun, name); … … 127 127 } 128 128 129 static int test3_dev_add(ddf_dev_t *dev)129 static errno_t test3_dev_add(ddf_dev_t *dev) 130 130 { 131 int rc = EOK;131 errno_t rc = EOK; 132 132 test3_t *test3; 133 133 … … 153 153 } 154 154 155 static int test3_dev_remove(ddf_dev_t *dev)155 static errno_t test3_dev_remove(ddf_dev_t *dev) 156 156 { 157 157 test3_t *test3 = (test3_t *)ddf_dev_data_get(dev); 158 158 char *fun_name; 159 int rc;159 errno_t rc; 160 160 size_t i; 161 161 162 162 for (i = 0; i < NUM_FUNCS; i++) { 163 rc = asprintf(&fun_name, "test3_%zu", i); 164 if (rc < 0) { 165 ddf_msg(LVL_ERROR, "Failed to format string: %s", str_error(rc)); 163 if (asprintf(&fun_name, "test3_%zu", i) < 0) { 164 ddf_msg(LVL_ERROR, "Failed to format string: No memory"); 166 165 return ENOMEM; 167 166 } … … 177 176 } 178 177 179 static int test3_fun_online(ddf_fun_t *fun)178 static errno_t test3_fun_online(ddf_fun_t *fun) 180 179 { 181 180 ddf_msg(LVL_DEBUG, "test3_fun_online()"); … … 183 182 } 184 183 185 static int test3_fun_offline(ddf_fun_t *fun)184 static errno_t test3_fun_offline(ddf_fun_t *fun) 186 185 { 187 186 ddf_msg(LVL_DEBUG, "test3_fun_offline()");
Note:
See TracChangeset
for help on using the changeset viewer.