ethaddr_list and eth_of_get_fixup_node are used unconditionally in
of_tlv_fixup, but there is no dependency on CONFIG_NET for CONFIG_TLV.

Turn the ethernet-related fixup code into dead code if CONFIG_NET is
disabled and emit a warning to fix this.

Reported-by: [email protected]
Signed-off-by: Ahmad Fatoum <[email protected]>
---
 common/tlv/parser.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/common/tlv/parser.c b/common/tlv/parser.c
index 7e1514758271..010e4cce38b0 100644
--- a/common/tlv/parser.c
+++ b/common/tlv/parser.c
@@ -187,6 +187,11 @@ int of_tlv_fixup(struct device_node *root, void *ctx)
        if (!ethaddrs)
                return 0;
 
+       if (!IS_ENABLED(CONFIG_NET)) {
+               pr_warn("CONFIG_NET disabled, so skipping ethernet-address 
trimming in fixup\n");
+               return 0;
+       }
+
        list_for_each_entry(addr, &ethaddr_list, list) {
                char propname[sizeof("address-4294967295")];
                const char *enetaddr_tlv_str;
-- 
2.47.3


Reply via email to