From: Tom Rini Date: Wed, 31 Oct 2012 13:30:41 +0000 (+0000) Subject: usb gadget ether: Fix warning in is_eth_addr_valid() X-Git-Tag: v2013.01-rc1~2 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=57a87a25f7563158d2b8a83d782568f1e6fc7fc5;p=u-boot usb gadget ether: Fix warning in is_eth_addr_valid() The gadget ethernet driver needs to keep copies of the MAC address (at both endpoints) as strings so it needs a custom function for validation of the MAC. It was not however performing a totally correct check and also was emitting a warning about a set but unused variable. The solution to both is that after checking the string contents we use the standard test for a valid MAC. Cc: Joe Hershberger Cc: Marek Vasut Signed-off-by: Tom Rini Acked-by: Joe Hershberger --- diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c index 1e187e5b52..8b24e00e27 100644 --- a/drivers/usb/gadget/ether.c +++ b/drivers/usb/gadget/ether.c @@ -1978,8 +1978,8 @@ static int is_eth_addr_valid(char *str) p = q; } - if (i == 6) /* it looks ok */ - return 1; + /* Now check the contents. */ + return is_valid_ether_addr(ea); } return 0; }