Subject: Re: [PATCH] via-rhine: do not abort due to invalid MAC address

From: Florian Fainelli <[email-masked]>
Date: Wed, 2 Mar 2011 19:01:39 +0100

Hello,

On Wednesday 02 March 2011 17:32:33 Roger Luethi wrote:
> From: "Alex G." <[email-masked]>
> 
> via-rhine drops out of the init code if the hardware provides an invalid
> MAC address. I have several reports of Rhine NICs doing just that. The
> hardware still works, though; continuing the init process gives the user a
> chance to fix the MAC address using "ifconfig ethX hw ether" which appears
> to result in a perfectly useable network adapter.
> 
> Most recent report and patch provided by Alex G.
> 
> Signed-off-by: "Alex G." <[email-masked]>
> Signed-off-by: Roger Luethi <[email-masked]>
> 
> diff --git a/linux-2.6.35.11/drivers/net/via-rhine.c b/via-rhine.c
> index 4930f9d..a1189f4 100644
> --- a/linux-2.6.35.11/drivers/net/via-rhine.c
> +++ b/via-rhine.c
> @@ -766,8 +766,12 @@ static int __devinit rhine_init_one(struct pci_dev
> *pdev,
> 
>  	if (!is_valid_ether_addr(dev->perm_addr)) {
>  		rc = -EIO;
> -		printk(KERN_ERR "Invalid MAC address\n");
> -		goto err_out_unmap;
> +		printk(KERN_ERR "via-rhine: invalid MAC address: %pM. "
> +				"Use ifconfig to configure valid address.\n",
> +				dev->dev_addr);
> +		/* The device may still be used normally if a valid MAC is 
configured
> +		 * We do not consider this a fatal error, and continue 
initialization
> +		 */
>  	}

Why not generate a valid random ethernet address using random_ether_addr() 
instead?
--
Florian