summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/sunplus
diff options
context:
space:
mode:
authorJiapeng Chong <jiapeng.chong@linux.alibaba.com>2022-05-12 14:09:05 +0800
committerDavid S. Miller <davem@davemloft.net>2022-05-13 11:26:59 +0100
commita19cef450bb6b1365c3bd5c82952f95b76688143 (patch)
tree81d59eb534d4dab10ad39466166a91646aa15abd /drivers/net/ethernet/sunplus
parentb67fd3d9d94223b424674f45eeadeff58b4b03ef (diff)
downloadlinux-stable-a19cef450bb6b1365c3bd5c82952f95b76688143.tar.gz
linux-stable-a19cef450bb6b1365c3bd5c82952f95b76688143.tar.bz2
linux-stable-a19cef450bb6b1365c3bd5c82952f95b76688143.zip
net: ethernet: Use swap() instead of open coding it
Clean the following coccicheck warning: ./drivers/net/ethernet/sunplus/spl2sw_driver.c:217:27-28: WARNING opportunity for swap(). ./drivers/net/ethernet/sunplus/spl2sw_driver.c:222:27-28: WARNING opportunity for swap(). Reported-by: Abaci Robot <abaci@linux.alibaba.com> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/sunplus')
-rw-r--r--drivers/net/ethernet/sunplus/spl2sw_driver.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/drivers/net/ethernet/sunplus/spl2sw_driver.c b/drivers/net/ethernet/sunplus/spl2sw_driver.c
index 8320fa833d3e..1cb7076f946d 100644
--- a/drivers/net/ethernet/sunplus/spl2sw_driver.c
+++ b/drivers/net/ethernet/sunplus/spl2sw_driver.c
@@ -204,28 +204,16 @@ static const struct net_device_ops netdev_ops = {
static void spl2sw_check_mac_vendor_id_and_convert(u8 *mac_addr)
{
- u8 tmp;
-
/* Byte order of MAC address of some samples are reversed.
* Check vendor id and convert byte order if it is wrong.
* OUI of Sunplus: fc:4b:bc
*/
if (mac_addr[5] == 0xfc && mac_addr[4] == 0x4b && mac_addr[3] == 0xbc &&
(mac_addr[0] != 0xfc || mac_addr[1] != 0x4b || mac_addr[2] != 0xbc)) {
- /* Swap mac_addr[0] and mac_addr[5] */
- tmp = mac_addr[0];
- mac_addr[0] = mac_addr[5];
- mac_addr[5] = tmp;
-
- /* Swap mac_addr[1] and mac_addr[4] */
- tmp = mac_addr[1];
- mac_addr[1] = mac_addr[4];
- mac_addr[4] = tmp;
-
- /* Swap mac_addr[2] and mac_addr[3] */
- tmp = mac_addr[2];
- mac_addr[2] = mac_addr[3];
- mac_addr[3] = tmp;
+
+ swap(mac_addr[0], mac_addr[5]);
+ swap(mac_addr[1], mac_addr[4]);
+ swap(mac_addr[2], mac_addr[3]);
}
}