lkml.org 
[lkml]   [2018]   [Jun]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [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

\
 
 \ /
  Last update: 2018-06-25 11:50    [W:0.093 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site