]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
log: uclass_get_name() depends on CONFIG_SPL_DM
authorHeinrich Schuchardt <xypron.glpk@gmx.de>
Mon, 8 Jun 2020 16:04:22 +0000 (18:04 +0200)
committerSimon Glass <sjg@chromium.org>
Fri, 10 Jul 2020 00:57:22 +0000 (18:57 -0600)
If CONFIG_SPL_DM=n and CONFIG_SPL_LOG=y a build error occurs:

ld.bfd: common/built-in.o: in function `log_get_cat_name':
common/log.c:48: undefined reference to `uclass_get_name'
make[1]: *** [scripts/Makefile.spl:422: spl/u-boot-spl] Error 1

Call uclass_get_name() only if DM is enabled.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
common/log.c

index c5b9b489ca3775f2376a72fa8747e60b5cee1aa3..d7ce74f6b31ce89363a15c4746eeeae19f2cf2ba 100644 (file)
@@ -45,7 +45,11 @@ const char *log_get_cat_name(enum log_category_t cat)
        if (cat >= LOGC_NONE)
                return log_cat_name[cat - LOGC_NONE];
 
+#if CONFIG_IS_ENABLED(DM)
        name = uclass_get_name((enum uclass_id)cat);
+#else
+       name = NULL;
+#endif
 
        return name ? name : "<missing>";
 }