staging: rtl8712: Use ether_addr_copy() instead of memcpy()
authorJagan Teki <jteki@openedev.com>
Mon, 18 May 2015 16:32:45 +0000 (22:02 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 31 May 2015 02:47:56 +0000 (11:47 +0900)
Fixes Warning encounter this by applying checkpatch.pl against this file:
Prefer ether_addr_copy() over memcpy() if the Ethernet addresses
are __aligned(2)

pahole output for respective structures:
- addr->sa_data
struct sockaddr {
sa_family_t                sa_family;            /*     0     2 */
char                       sa_data[14];          /*     2    14 */

/* size: 16, cachelines: 1, members: 2 */
/* last cacheline: 16 bytes */
};

- pnetdev->dev_addr
dev_addr is interface address infor from generic net_device structure
which is properly aligned and have some patches with this change as well.
"staging: rtl8712: fix Prefer ether_addr_copy() over memcpy()"
(sha1: 36e4d8826b317080e283e4edd08bf8d5ac706f38)

Signed-off-by: Jagan Teki <jteki@openedev.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Florian Schilhabel <florian.c.schilhabel@googlemail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8712/os_intfs.c

index 6e776e5433f67bfb96e6a5dda56c46713842436e..d5f4c4d26a9c13b00219c0f9409d8ba560f5d7db 100644 (file)
@@ -181,7 +181,7 @@ static int r871x_net_set_mac_address(struct net_device *pnetdev, void *p)
        struct sockaddr *addr = p;
 
        if (padapter->bup == false)
-               memcpy(pnetdev->dev_addr, addr->sa_data, ETH_ALEN);
+               ether_addr_copy(pnetdev->dev_addr, addr->sa_data);
        return 0;
 }