Skip to content

Commit 072dc11

Browse files
ngc891gregkh
authored andcommitted
staging/ozwpan: coding style ether_addr_copy
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); Signed-off-by: Jerome Pinot <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent a771033 commit 072dc11

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

drivers/staging/ozwpan/ozcdev.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ static int oz_set_active_pd(const u8 *addr)
217217
pd = oz_pd_find(addr);
218218
if (pd) {
219219
spin_lock_bh(&g_cdev.lock);
220-
memcpy(g_cdev.active_addr, addr, ETH_ALEN);
220+
ether_addr_copy(g_cdev.active_addr, addr);
221221
old_pd = g_cdev.active_pd;
222222
g_cdev.active_pd = pd;
223223
spin_unlock_bh(&g_cdev.lock);
@@ -283,7 +283,7 @@ static long oz_cdev_ioctl(struct file *filp, unsigned int cmd,
283283
u8 addr[ETH_ALEN];
284284
oz_dbg(ON, "OZ_IOCTL_GET_ACTIVE_PD\n");
285285
spin_lock_bh(&g_cdev.lock);
286-
memcpy(addr, g_cdev.active_addr, ETH_ALEN);
286+
ether_addr_copy(addr, g_cdev.active_addr);
287287
spin_unlock_bh(&g_cdev.lock);
288288
if (copy_to_user((void __user *)arg, addr, ETH_ALEN))
289289
return -EFAULT;

drivers/staging/ozwpan/ozpd.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <linux/timer.h>
99
#include <linux/sched.h>
1010
#include <linux/netdevice.h>
11+
#include <linux/etherdevice.h>
1112
#include <linux/errno.h>
1213
#include "ozdbg.h"
1314
#include "ozprotocol.h"
@@ -173,7 +174,7 @@ struct oz_pd *oz_pd_alloc(const u8 *mac_addr)
173174
pd->last_rx_pkt_num = 0xffffffff;
174175
oz_pd_set_state(pd, OZ_PD_S_IDLE);
175176
pd->max_tx_size = OZ_MAX_TX_SIZE;
176-
memcpy(pd->mac_addr, mac_addr, ETH_ALEN);
177+
ether_addr_copy(pd->mac_addr, mac_addr);
177178
if (0 != oz_elt_buf_init(&pd->elt_buff)) {
178179
kfree(pd);
179180
pd = NULL;

0 commit comments

Comments
 (0)