diff mbox series

[1/1] log: uclass_get_name() depends on CONFIG_SPL_DM

Message ID 20200608160422.46083-1-xypron.glpk@gmx.de
State Accepted
Commit 6c9e4175491900b9fa5d9283c4a449f00285162d
Headers show
Series [1/1] log: uclass_get_name() depends on CONFIG_SPL_DM | expand

Commit Message

Heinrich Schuchardt June 8, 2020, 4:04 p.m. UTC
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 at gmx.de>
---
 common/log.c | 4 ++++
 1 file changed, 4 insertions(+)

--
2.26.2

Comments

Simon Glass June 8, 2020, 5:12 p.m. UTC | #1
Hi Heinrich,

On Mon, 8 Jun 2020 at 10:04, Heinrich Schuchardt <xypron.glpk at gmx.de> wrote:
>
> 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 at gmx.de>
> ---
>  common/log.c | 4 ++++
>  1 file changed, 4 insertions(+)

Reviewed-by: Simon Glass <sjg at chromium.org>
diff mbox series

Patch

diff --git a/common/log.c b/common/log.c
index c5b9b489ca..d7ce74f6b3 100644
--- a/common/log.c
+++ b/common/log.c
@@ -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>";
 }