[U-Boot] [PATCH] Ethernet: let user know if there is no valid ethernet address

Wolfgang Denk wd at denx.de
Fri Jul 11 17:27:38 CEST 2014


Dear Pavel Machek,

In message <20140711094213.GA4385 at amd.pavel.ucw.cz> you wrote:
> When there's no ethernet address available, u-boot currently prints
> "could not set ethernet address", but fails to mention that there's no
> address it could set. Make it a bit less confusing.
> 
> Signed-off-by: Pavel Machek <pavel at denx.de>
> 
> diff --git a/net/eth.c b/net/eth.c
> index 99386e3..b72ae84 100644
> --- a/net/eth.c
> +++ b/net/eth.c
> @@ -179,10 +179,12 @@ int eth_write_hwaddr(struct eth_device *dev, const char *base_name,
>  			dev->name);
>  	}
>  
> -	if (dev->write_hwaddr &&
> -			!eth_mac_skip(eth_number)) {
> -		if (!is_valid_ether_addr(dev->enetaddr))
> +	if (dev->write_hwaddr && !eth_mac_skip(eth_number)) {
> +		if (!is_valid_ether_addr(dev->enetaddr)) {
> +			printf("\nError: %s ethernet address not valid: %pM\n",
> +				 dev->name, dev->enetaddr);

Sorry, but this is not really helpful.  "Not set" and "not valid" are
different things.  "Not valid" might be confusing when none is set at
all.

Also, if I understand correctly, we will now have _two_ error messages
("ethernet address not valid" followed by "could not set ethernet
address")?  That's not so nice either.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"Pull the wool over your own eyes!"                - J.R. "Bob" Dobbs


More information about the U-Boot mailing list