Commit 51487ae7 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by David S. Miller

usbnet: re-use native hex2bin()

Call hex2bin() library function, instead of doing conversion here.
Signed-off-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: default avatarOliver Neukum <oneukum@suse.de>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent bc0247a4
...@@ -160,20 +160,19 @@ EXPORT_SYMBOL_GPL(usbnet_get_endpoints); ...@@ -160,20 +160,19 @@ EXPORT_SYMBOL_GPL(usbnet_get_endpoints);
int usbnet_get_ethernet_addr(struct usbnet *dev, int iMACAddress) int usbnet_get_ethernet_addr(struct usbnet *dev, int iMACAddress)
{ {
int tmp, i; int tmp = -1, ret;
unsigned char buf [13]; unsigned char buf [13];
tmp = usb_string(dev->udev, iMACAddress, buf, sizeof buf); ret = usb_string(dev->udev, iMACAddress, buf, sizeof buf);
if (tmp != 12) { if (ret == 12)
tmp = hex2bin(dev->net->dev_addr, buf, 6);
if (tmp < 0) {
dev_dbg(&dev->udev->dev, dev_dbg(&dev->udev->dev,
"bad MAC string %d fetch, %d\n", iMACAddress, tmp); "bad MAC string %d fetch, %d\n", iMACAddress, tmp);
if (tmp >= 0) if (ret >= 0)
tmp = -EINVAL; ret = -EINVAL;
return tmp; return ret;
} }
for (i = tmp = 0; i < 6; i++, tmp += 2)
dev->net->dev_addr [i] =
(hex_to_bin(buf[tmp]) << 4) + hex_to_bin(buf[tmp + 1]);
return 0; return 0;
} }
EXPORT_SYMBOL_GPL(usbnet_get_ethernet_addr); EXPORT_SYMBOL_GPL(usbnet_get_ethernet_addr);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment