Re: [PATCH 3/3] staging/ozwpan: coding style ether_addr_copy

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

 



On Thu, Mar 13, 2014 at 10:21:44AM +0900, Jérôme Pinot wrote:
> This fixes the following issues detected by checkpatch.pl:
> 
>  WARNING: Prefer ether_addr_copy() over memcpy() if the Ethernet addresses are __aligned(2)
>  #220: FILE: drivers/staging/ozwpan/ozcdev.c:220:
>  +              memcpy(g_cdev.active_addr, addr, ETH_ALEN);
> 
>  WARNING: Prefer ether_addr_copy() over memcpy() if the Ethernet addresses are __aligned(2)
>  #286: FILE: drivers/staging/ozwpan/ozcdev.c:286:
>  +                      memcpy(addr, g_cdev.active_addr, ETH_ALEN);
> 
>  WARNING: Prefer ether_addr_copy() over memcpy() if the Ethernet addresses are __aligned(2)
>  #176: FILE: drivers/staging/ozwpan/ozpd.c:176:
>  +              memcpy(pd->mac_addr, mac_addr, ETH_ALEN);
> 
>  WARNING: Prefer ether_addr_copy() over memcpy() if the Ethernet addresses are __aligned(2)
>  #795: FILE: drivers/staging/ozwpan/ozproto.c:795:
>  +              memcpy(&addr[count++], pd->mac_addr, ETH_ALEN);
> 
> Signed-off-by: Jerome Pinot <ngc891@xxxxxxxxx>
> ---
>  drivers/staging/ozwpan/ozcdev.c  | 4 ++--
>  drivers/staging/ozwpan/ozpd.c    | 2 +-
>  drivers/staging/ozwpan/ozproto.c | 2 +-
>  3 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/ozwpan/ozcdev.c b/drivers/staging/ozwpan/ozcdev.c
> index 5de5981..10c0a96 100644
> --- a/drivers/staging/ozwpan/ozcdev.c
> +++ b/drivers/staging/ozwpan/ozcdev.c
> @@ -217,7 +217,7 @@ static int oz_set_active_pd(const u8 *addr)
>  	pd = oz_pd_find(addr);
>  	if (pd) {
>  		spin_lock_bh(&g_cdev.lock);
> -		memcpy(g_cdev.active_addr, addr, ETH_ALEN);
> +		ether_addr_copy(g_cdev.active_addr, addr);

Are you sure this will work?

You have to check the alignment of the variable.

Also, this breaks the build, you need to include some kind of .h file to
get this to work, please ALWAYS test your patches to make sure they
don't break things.

greg k-h
_______________________________________________
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