Messages in this thread | | | From | Andy Shevchenko <> | Date | Mon, 25 Jun 2018 12:49:49 +0300 | Subject | Re: [PATCH] staging: rtl8723bs: do not use assignment in if condition |
| |
On Fri, Jun 22, 2018 at 8:28 PM, Joe Perches <joe@perches.com> wrote: > On Fri, 2018-06-22 at 14:48 +0200, Michael Straube wrote: >> On 06/22/18 12:57, Dan Carpenter wrote:
> Output from checkpatch is not gospel and can be ignored > whenever appropriate. > > I think the below is ok: > > if ((is_broadcast_ether_addr(mac) || is_zero_ether_addr(mac)) && > ((addr = of_get_property(np, "local-mac-address", &len)) && > len == ETH_ALEN)) > memcpy(mac_addr, addr, ETH_ALEN); > else > memcpy(mac_addr, ""\x00\xe0\x4c\x87\x00\x00", ETH_ALEN); > > Although the last memcpy of a fixed mac address could > probably use eth_random_addr to reduce the likelihood > of mac address collision
...and first one looks like ether_addr_copy().
> so maybe > > if ((is_broadcast_ether_addr(mac) || is_zero_ether_addr(mac)) && > ((addr = of_get_property(np, "local-mac-address", &len)) && > > len == ETH_ALEN)) > memcpy(mac_addr, addr, ETH_ALEN); > else > eth_random_addr(mac_addr); > >> If yes, I'm not sure how to proceed as these are the very first patches I send. >> Should I send a v2 patch with both changes or just a v2 with "np" removed and >> another one for adding 'is_broadcast_ether_addr' and 'is_zero_ether_addr' checks?
-- With Best Regards, Andy Shevchenko
| |