[U-Boot] [PATCH v2] net: asix: add support for AX88772B

Mike Frysinger vapier at gentoo.org
Mon Aug 20 21:21:49 CEST 2012


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120820/7674ac37/attachment.pgp>


More information about the U-Boot mailing list