From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758597AbbA2WLn (ORCPT ); Thu, 29 Jan 2015 17:11:43 -0500 Received: from mail-wi0-f181.google.com ([209.85.212.181]:41162 "EHLO mail-wi0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750780AbbA2WLm (ORCPT ); Thu, 29 Jan 2015 17:11:42 -0500 Date: Fri, 30 Jan 2015 00:11:36 +0200 From: Heba Aamer To: devel@driverdev.osuosl.org Cc: Larry.Finger@lwfinger.net, florian.c.schilhabel@googlemail.com, gregkh@linuxfoundation.org, tapaswenipathak@gmail.com, thomas@grouk.net, sudipm.mukherjee@gmail.com, rickard_strandqvist@spectrumdigital.se, linux-kernel@vger.kernel.org Subject: [PATCH v2] staging: rtl8712: fix Prefer ether_addr_copy() over memcpy() Message-ID: <20150129221136.GA22253@mohammed-Inspiron-3537> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch fixes the following checkpatch.pl warning: Prefer ether_addr_copy() over memcpy() if the Ethernet addresses are __aligned(2) pahole showed that the struct used pnetdev->dev_addr is aligned to u16. Moreover mac is a simple array, pdata is a pointer that starts from an even offset. Signed-off-by: Heba Aamer --- v2: modifying patch description drivers/staging/rtl8712/usb_intf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8712/usb_intf.c b/drivers/staging/rtl8712/usb_intf.c index 15f0d42..a2f2dfb 100644 --- a/drivers/staging/rtl8712/usb_intf.c +++ b/drivers/staging/rtl8712/usb_intf.c @@ -463,7 +463,7 @@ static int r871xu_drv_init(struct usb_interface *pusb_intf, /* Use the mac address stored in the Efuse * offset = 0x12 for usb in efuse */ - memcpy(mac, &pdata[0x12], ETH_ALEN); + ether_addr_copy(mac, &pdata[0x12]); } eeprom_CustomerID = pdata[0x52]; switch (eeprom_CustomerID) { @@ -580,7 +580,7 @@ static int r871xu_drv_init(struct usb_interface *pusb_intf, } else dev_info(&udev->dev, "r8712u: MAC Address from efuse = %pM\n", mac); - memcpy(pnetdev->dev_addr, mac, ETH_ALEN); + ether_addr_copy(pnetdev->dev_addr, mac); } /* step 6. Load the firmware asynchronously */ if (rtl871x_load_fw(padapter)) -- 1.7.9.5