Re: [PATCH] powerpc: fix MAC address entries for 83xx, 85xx, and 86xx device trees
From: Timur Tabi <hidden>
Date: 2007-06-26 15:59:02
From: Timur Tabi <hidden>
Date: 2007-06-26 15:59:02
Segher Boessenkool wrote:
It is not safe since you might happen upon a network device without "mac-address" property (since the device hasn't been used at boot in a real OF, or the firmware knows no mac address at all, etc.) and no "local-mac-address" either -- but it _does_ have an "address", and it can have an "address" with the correct semantics, not the broken stuff. It's not very likely for this happens, sure :-)
Maybe we're using different definitions of "safe" here. When I said the code was "safe", I meant that it if U-Boot puts the MAC address into the 'address' property only, of_get_mac_address() will safely detect that and use the address: pp = of_find_property(np, "address", NULL); if (pp && (pp->length == 6) && is_valid_ether_addr(pp->value)) return pp->value; It checks if the property exists, that it's 6 bytes long, and that it is a valid MAC address. AFAIK, no version of U-Boot and no DTS file, past or present, will confuse this code. -- Timur Tabi Linux Kernel Developer @ Freescale