diff mbox series

[v7,2/3] dm: core: fix dev_read_alias_highest_id() without libfdt

Message ID 20200601234709.31121-3-michael@walle.cc
State Accepted
Commit 0a6b75f7d8cbf7edc62c7d132b521703f1e2a53d
Headers show
Series dm: uclass: don't assign aliased seq numbers | expand

Commit Message

Michael Walle June 1, 2020, 11:47 p.m. UTC
If CONFIG_DM_DEV_READ_INLINE is set, dev_read_alias_highest_id() calls
libfdt_get_highest_id(). But this function is only available if we have
libfdt compiled in. If its not available return -1, which matches the
return code for no alias found.

This fixes the following error on omapl138_lcdk:
arm-linux-gnueabi-ld.bfd: drivers/built-in.o: in function `dev_read_alias_highest_id':
/home/mw/repo/u-boot/include/dm/read.h:986: undefined reference to `fdtdec_get_alias_highest_id'

Signed-off-by: Michael Walle <michael at walle.cc>
---
 include/dm/read.h | 2 ++
 1 file changed, 2 insertions(+)

Comments

Simon Glass June 5, 2020, 3:36 a.m. UTC | #1
On Mon, 1 Jun 2020 at 17:47, Michael Walle <michael at walle.cc> wrote:
>
> If CONFIG_DM_DEV_READ_INLINE is set, dev_read_alias_highest_id() calls
> libfdt_get_highest_id(). But this function is only available if we have
> libfdt compiled in. If its not available return -1, which matches the
> return code for no alias found.
>
> This fixes the following error on omapl138_lcdk:
> arm-linux-gnueabi-ld.bfd: drivers/built-in.o: in function `dev_read_alias_highest_id':
> /home/mw/repo/u-boot/include/dm/read.h:986: undefined reference to `fdtdec_get_alias_highest_id'
>
> Signed-off-by: Michael Walle <michael at walle.cc>
> ---
>  include/dm/read.h | 2 ++
>  1 file changed, 2 insertions(+)

Reviewed-by: Simon Glass <sjg at chromium.org>
Simon Glass June 13, 2020, 3:11 a.m. UTC | #2
On Mon, 1 Jun 2020 at 17:47, Michael Walle <michael at walle.cc> wrote:
>
> If CONFIG_DM_DEV_READ_INLINE is set, dev_read_alias_highest_id() calls
> libfdt_get_highest_id(). But this function is only available if we have
> libfdt compiled in. If its not available return -1, which matches the
> return code for no alias found.
>
> This fixes the following error on omapl138_lcdk:
> arm-linux-gnueabi-ld.bfd: drivers/built-in.o: in function `dev_read_alias_highest_id':
> /home/mw/repo/u-boot/include/dm/read.h:986: undefined reference to `fdtdec_get_alias_highest_id'
>
> Signed-off-by: Michael Walle <michael at walle.cc>
> ---
>  include/dm/read.h | 2 ++
>  1 file changed, 2 insertions(+)

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

Applied to u-boot-dm, thanks!
diff mbox series

Patch

diff --git a/include/dm/read.h b/include/dm/read.h
index b952551d55..1c1bc3702f 100644
--- a/include/dm/read.h
+++ b/include/dm/read.h
@@ -983,6 +983,8 @@  static inline u64 dev_translate_dma_address(const struct udevice *dev,
 
 static inline int dev_read_alias_highest_id(const char *stem)
 {
+	if (!CONFIG_IS_ENABLED(OF_LIBFDT))
+		return -1;
 	return fdtdec_get_alias_highest_id(gd->fdt_blob, stem);
 }