Re: [PATCH] staging: rtl8723bs: refactor rtw_macaddr_cfg()

From: Andy Shevchenko
Date: Mon Jun 25 2018 - 05:51:16 EST


On Sat, Jun 23, 2018 at 12:45 PM, Michael Straube
<michael.straube@xxxxxxxxx> wrote:
> Using is_broadcast_ether_addr() and is_zero_ether_addr() instead of
> testing each byte of the mac[] array for 0xff and 0x00 shortens the
> code and improves readability.
>
> If np == NULL, of_get_property() returns NULL, hence the "np" check
> is not needed.
>
> Instead of a fixed default mac address use a random one to reduce the
> likelihood of mac address collision.
>
> Thanks to Joe Perches and Dan Carpenter.

> + if ((addr = of_get_property(np, "local-mac-address", &len)) &&
> len == ETH_ALEN) {
> memcpy(mac_addr, addr, ETH_ALEN);

ether_addr_copy()?

> } else {

> + eth_random_addr(mac_addr);
> + DBG_871X("MAC Address from efuse error, assign random one !!!\n");
> }

--
With Best Regards,
Andy Shevchenko