diff --git a/libs/libc/modlib/modlib_depend.c b/libs/libc/modlib/modlib_depend.c index eaa453d007..0f7eaf40e3 100644 --- a/libs/libc/modlib/modlib_depend.c +++ b/libs/libc/modlib/modlib_depend.c @@ -31,6 +31,8 @@ #include +#if CONFIG_MODLIB_MAXDEPEND > 0 + /**************************************************************************** * Public Functions ****************************************************************************/ @@ -55,7 +57,6 @@ int modlib_depend(FAR struct module_s *importer, FAR struct module_s *exporter) { -#if CONFIG_MODLIB_MAXDEPEND > 0 int freendx = -1; int i; @@ -127,10 +128,6 @@ int modlib_depend(FAR struct module_s *importer, DEBUGPANIC(); return -ENFILE; - -#else - return OK; -#endif } /**************************************************************************** @@ -152,7 +149,6 @@ int modlib_depend(FAR struct module_s *importer, int modlib_undepend(FAR struct module_s *importer) { -#if CONFIG_MODLIB_MAXDEPEND > 0 FAR struct module_s *exporter; int i; @@ -178,7 +174,8 @@ int modlib_undepend(FAR struct module_s *importer) importer->dependencies[i] = NULL; } } -#endif return OK; } + +#endif diff --git a/libs/libc/modlib/modlib_symbols.c b/libs/libc/modlib/modlib_symbols.c index 6e4e59bc03..078e276d00 100644 --- a/libs/libc/modlib/modlib_symbols.c +++ b/libs/libc/modlib/modlib_symbols.c @@ -198,7 +198,6 @@ static int modlib_symcallback(FAR struct module_s *modp, FAR void *arg) { FAR struct mod_exportinfo_s *exportinfo = (FAR struct mod_exportinfo_s *) arg; - int ret; /* Check if this module exports a symbol of that name */ @@ -212,12 +211,14 @@ static int modlib_symcallback(FAR struct module_s *modp, FAR void *arg) * stop the traversal. */ - ret = modlib_depend(exportinfo->modp, modp); +#if CONFIG_MODLIB_MAXDEPEND > 0 + int ret = modlib_depend(exportinfo->modp, modp); if (ret < 0) { berr("ERROR: modlib_depend failed: %d\n", ret); return ret; } +#endif return SYM_FOUND; } diff --git a/sched/module/mod_insmod.c b/sched/module/mod_insmod.c index b8ad7443dc..86b0f017a5 100644 --- a/sched/module/mod_insmod.c +++ b/sched/module/mod_insmod.c @@ -282,7 +282,9 @@ FAR void *insmod(FAR const char *filename, FAR const char *modname) errout_with_load: modlib_unload(&loadinfo); +#if CONFIG_MODLIB_MAXDEPEND > 0 modlib_undepend(modp); +#endif errout_with_registry_entry: kmm_free(modp); errout_with_loadinfo: