]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
usb gadget ether: Fix warning in is_eth_addr_valid()
authorTom Rini <trini@ti.com>
Wed, 31 Oct 2012 13:30:41 +0000 (13:30 +0000)
committerTom Rini <trini@ti.com>
Sun, 4 Nov 2012 18:00:38 +0000 (11:00 -0700)
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 <joe.hershberger@ni.com>
Cc: Marek Vasut <marex@denx.de>
Signed-off-by: Tom Rini <trini@ti.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
drivers/usb/gadget/ether.c

index 1e187e5b5261adbcdffcc30670438e9df7ed59dc..8b24e00e2715a4b493be67899a1197870354e667 100644 (file)
@@ -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;
 }