
20 Aug
2012
20 Aug
'12
9:21 p.m.
On Monday 20 August 2012 13:52:18 Lucas Stach wrote:
- memset(buf, 0, ETH_ALEN);
this memset is pointless
- for (i = 0; i < (ETH_ALEN >> 1); i++) {
memset(read_buf, 0, 2);
this memset is pointless
memcpy((buf + i*2), read_buf, 2);
use spaces: "i * 2"
- debug("MAC read from EEPROM: %02x:%02x:%02x:%02x:%02x:%02x\n",
buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]);
use %pM instead of spelling out each byte yourself
- if (asix_write_cmd(dev, AX_CMD_WRITE_NODE_ID, 0, 0, ETH_ALEN, buf)) {
printf("Failed to set MAC address.\n");
return -1;
- }
- return 0;
+}
ret = asix_write_cmd(...) if (ret) puts(...); return ret;
static struct asix_dongle asix_dongles[] = {
this probably should be const
--- a/include/usb_ether.h +++ b/include/usb_ether.h
+#ifdef CONFIG_USB_ETHER_ASIX
- int asix_flags;
+#endif };
looks like the usb ether stack is fundamentally flawed if drivers are allowed to screw with the structure. this is what "void *priv" fields are for. -mike