~martin-decky/helenos/rcu

« back to all changes in this revision

Viewing changes to uspace/drv/infrastructure/root/root.c

MergeĀ mainlineĀ changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
52
52
 
53
53
#include <ddf/driver.h>
54
54
#include <ddf/log.h>
55
 
#include <devman.h>
56
 
#include <ipc/devman.h>
57
55
 
58
56
#define NAME "root"
59
57
 
157
155
        /* Construct match ID. */
158
156
        if (asprintf(&match_id, PLATFORM_FUN_MATCH_ID_FMT, platform) == -1) {
159
157
                ddf_msg(LVL_ERROR, "Memory allocation failed.");
 
158
                free(platform);
160
159
                return ENOMEM;
161
160
        }
162
161
 
 
162
        free(platform);
 
163
 
163
164
        /* Add function. */
164
165
        ddf_msg(LVL_DEBUG, "Adding platform function. Function node is `%s' "
165
166
            " (%d %s)", PLATFORM_FUN_NAME, PLATFORM_FUN_MATCH_SCORE,
168
169
        fun = ddf_fun_create(dev, fun_inner, name);
169
170
        if (fun == NULL) {
170
171
                ddf_msg(LVL_ERROR, "Error creating function %s", name);
 
172
                free(match_id);
171
173
                return ENOMEM;
172
174
        }
173
175
 
175
177
        if (rc != EOK) {
176
178
                ddf_msg(LVL_ERROR, "Failed adding match IDs to function %s",
177
179
                    name);
 
180
                free(match_id);
178
181
                ddf_fun_destroy(fun);
179
182
                return rc;
180
183
        }
207
210
         * We ignore error occurrence because virtual devices shall not be
208
211
         * vital for the system.
209
212
         */
210
 
        add_virtual_root_fun(dev);
 
213
        (void) add_virtual_root_fun(dev);
211
214
 
212
215
        /* Register root device's children. */
213
216
        int res = add_platform_fun(dev);