libs/libc: fix compile warning about modlib_depend when CONFIG_MODLIB_MAXDEPEND = 0

modlib/modlib_symbols.c: In function ‘modlib_symcallback’:
modlib/modlib_symbols.c:215:13: warning: implicit declaration of function ‘modlib_depend’; did you mean ‘modlib_read’? [-Wimplicit-function-declaration]
  215 |       ret = modlib_depend(exportinfo->modp, modp);
      |             ^~~~~~~~~~~~~
      |             modlib_read

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
This commit is contained in:
dongjiuzhu1 2023-10-05 19:42:23 +08:00 committed by Xiang Xiao
parent e88a36fa92
commit db13ff2dd5
3 changed files with 9 additions and 9 deletions

View File

@ -31,6 +31,8 @@
#include <nuttx/lib/modlib.h>
#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

View File

@ -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;
}

View File

@ -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: