Re: [PATCH] staging: rtl8723bs: do not use assignment in if condition

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jun 22, 2018 at 8:28 PM, Joe Perches <joe@xxxxxxxxxxx> 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
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux