From: Peter Korsgaard <jacmet@sunsite•dk>
To: Wu Fengguang <wfg@linux•intel.com>
Cc: netdev@vger•kernel.org
Subject: Re: [PATCH] dm9601: warn on invalid mac address
Date: Tue, 06 Jan 2009 10:18:17 +0100 [thread overview]
Message-ID: <87zli4u71i.fsf@macbook.be.48ers.dk> (raw)
In-Reply-To: <20090106091050.GA19316@localhost> (Wu Fengguang's message of "Tue\, 6 Jan 2009 17\:10\:50 +0800")
>>>>> "Wu" == Wu Fengguang <wfg@linux•intel.com> writes:
Hi,
Wu> Add warnings on invalid mac address to help disclose/debug problems.
Wu> Signed-off-by: Wu Fengguang <fengguang.wu@intel•com>
Wu> ---
Wu> drivers/net/usb/dm9601.c | 12 +++++++++++-
Wu> 1 file changed, 11 insertions(+), 1 deletion(-)
Wu> --- linux-2.6.orig/drivers/net/usb/dm9601.c
Wu> +++ linux-2.6/drivers/net/usb/dm9601.c
Wu> @@ -401,8 +401,12 @@ static int dm9601_set_mac_address(struct
Wu> struct sockaddr *addr = p;
Wu> struct usbnet *dev = netdev_priv(net);
Wu> - if (!is_valid_ether_addr(addr->sa_data))
Wu> + if (!is_valid_ether_addr(addr->sa_data)) {
Wu> + DECLARE_MAC_BUF(mac_buf);
Wu> + print_mac(mac_buf, addr->sa_data);
Wu> + dev_warn(&net->dev, "not setting invalid mac address %s\n", mac_buf);
This should be an error and not a warning.
Notice that print_mac returns the string, so you can do:
dev_err(&net->dev, "... %s", print_mac(mac_buf, addr->sa_data));
Wu> memcpy(net->dev_addr, addr->sa_data, net->addr_len);
Wu> dm_write_async(dev, DM_PHY_ADDR, net->addr_len, net->dev_addr);
Wu> @@ -449,6 +453,12 @@ static int dm9601_bind(struct usbnet *de
Wu> */
Wu> if (is_valid_ether_addr(mac))
Wu> memcpy(dev->net->dev_addr, mac, ETH_ALEN);
Wu> + else {
Wu> + DECLARE_MAC_BUF(mac_buf);
Wu> + print_mac(mac_buf, mac);
Wu> + devdbg(dev, "EEPROM reported mac address %s is invalid,"
Wu> + " use the randomly generated one.", mac_buf);
And this should be a warning.
--
Bye, Peter Korsgaard
next prev parent reply other threads:[~2009-01-06 9:18 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-06 9:10 [PATCH] dm9601: warn on invalid mac address Wu Fengguang
2009-01-06 9:18 ` Peter Korsgaard [this message]
2009-01-06 9:47 ` Wu Fengguang
2009-01-06 11:17 ` Peter Korsgaard
2009-01-07 4:52 ` Wu Fengguang
2009-01-07 8:24 ` Peter Korsgaard
2009-01-08 18:45 ` David Miller
2009-01-06 11:52 ` Ben Hutchings
2009-01-06 18:52 ` David Miller
2009-01-07 4:55 ` Wu Fengguang
2009-01-07 8:25 ` Peter Korsgaard
2009-01-08 18:47 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87zli4u71i.fsf@macbook.be.48ers.dk \
--to=jacmet@sunsite$(echo .)dk \
--cc=netdev@vger$(echo .)kernel.org \
--cc=wfg@linux$(echo .)intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox