Subject: Re: [PATCH] powerpc: fix MAC address entries for 83xx, 85xx, and 86xx device trees

From: Timur Tabi <[email-masked]>
Date: Tue, 26 Jun 2007 10:58:53 -0500

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