When compiling the sandbox with CONFIG_LTO=n, CONFIG_NET=n an error is
reported:

    /usr/bin/ld: lib/efi_loader/efi_device_path.o:
    in function `efi_dp_from_eth':
    lib/efi_loader/efi_device_path.c:985:(.text+0xcf4):
    undefined reference to `eth_get_dev'

Add a missing configuration check.

As the function is exported __maybe_unused can be removed.

Signed-off-by: Heinrich Schuchardt <heinrich.schucha...@canonical.com>
---
 lib/efi_loader/efi_device_path.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/efi_loader/efi_device_path.c b/lib/efi_loader/efi_device_path.c
index ed7214f3a3..f3a0e855b3 100644
--- a/lib/efi_loader/efi_device_path.c
+++ b/lib/efi_loader/efi_device_path.c
@@ -977,11 +977,14 @@ struct efi_device_path *efi_dp_from_uart(void)
        return buf;
 }
 
-struct efi_device_path __maybe_unused *efi_dp_from_eth(void)
+struct efi_device_path *efi_dp_from_eth(void)
 {
        void *buf, *start;
        unsigned dpsize = 0;
 
+       if (!IS_ENABLED(CONFIG_NETDEVICES))
+               return NULL;
+
        assert(eth_get_dev());
 
        dpsize += dp_size(eth_get_dev());
-- 
2.40.1

Reply via email to