err = array_append_unique(&mod->deps, sym->owner);
if (err == -EEXIST)
return 0;
- if (err < 0)
+ if (err < 0) {
+ CRIT("failed to add symbol %s to module %s: %s\n",
+ sym->name, mod->path, strerror(-err));
return err;
+ }
sym->owner->users++;
SHOW("%s needs \"%s\": %s\n", mod->path, sym->name, sym->owner->path);
{
const struct cfg *cfg = depmod->cfg;
struct kmod_list *l;
+ int ret = 0;
DBG("do dependencies of %s\n", mod->path);
kmod_list_foreach(l, mod->dep_sym_list) {
int bindtype = kmod_module_dependency_symbol_get_bind(l);
struct symbol *sym = depmod_symbol_find(depmod, name);
uint8_t is_weak = bindtype == KMOD_SYMBOL_WEAK;
+ int err;
if (sym == NULL) {
DBG("%s needs (%c) unknown symbol %s\n",
mod->path, name);
}
- mod_add_dependency(mod, sym);
+ err = mod_add_dependency(mod, sym);
+ if (err < 0)
+ ret = err;
}
- return 0;
+ return ret;
}
static int depmod_load_dependencies(struct depmod *depmod)
{
struct mod **itr, **itr_end;
+ int ret = 0;
DBG("load dependencies (%zd modules, %u symbols)\n",
depmod->modules.count, hash_get_count(depmod->symbols));
itr_end = itr + depmod->modules.count;
for (; itr < itr_end; itr++) {
struct mod *mod = *itr;
+ int err;
if (mod->dep_sym_list == NULL) {
DBG("ignoring %s: no dependency symbols\n", mod->path);
continue;
}
- depmod_load_module_dependencies(depmod, mod);
+ err = depmod_load_module_dependencies(depmod, mod);
+ if (err < 0)
+ ret = err;
}
DBG("loaded dependencies (%zd modules, %u symbols)\n",
depmod->modules.count, hash_get_count(depmod->symbols));
- return 0;
+ return ret;
}
static int dep_cmp(const void *pa, const void *pb)
v = v->parent, n++) {
sz += v->mod->modnamesz - 1;
- array_append(&reverse, v);
+ rc = array_append(&reverse, v);
+ if (rc < 0)
+ return rc;
rc = hash_add(loop_set, v->mod->modname, NULL);
if (rc != 0)
return rc;