Skip to content

Commit

Permalink
qed: Replace memset with eth_zero_addr
Browse files Browse the repository at this point in the history
Use eth_zero_addr to assign zero address to the given address array
instead of memset when the second argument in memset is address
of zero. Also, it makes the code clearer

Signed-off-by: Shyam Saini <mayhs11saini@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Shyam Saini authored and David S. Miller committed Jan 17, 2017
1 parent 53631a5 commit 0ee28e3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion drivers/net/ethernet/qlogic/qed/qed_l2.c
Original file line number Diff line number Diff line change
Expand Up @@ -1846,7 +1846,7 @@ static int qed_fill_eth_dev_info(struct qed_dev *cdev,
qed_fill_dev_info(cdev, &info->common);

if (IS_VF(cdev))
memset(info->common.hw_mac, 0, ETH_ALEN);
eth_zero_addr(info->common.hw_mac);

return 0;
}
Expand Down
7 changes: 3 additions & 4 deletions drivers/net/ethernet/qlogic/qed/qed_sriov.c
Original file line number Diff line number Diff line change
Expand Up @@ -1224,7 +1224,7 @@ static void qed_iov_clean_vf(struct qed_hwfn *p_hwfn, u8 vfid)
return;

/* Clear the VF mac */
memset(vf_info->mac, 0, ETH_ALEN);
eth_zero_addr(vf_info->mac);

vf_info->rx_accept_mode = 0;
vf_info->tx_accept_mode = 0;
Expand Down Expand Up @@ -2626,8 +2626,7 @@ static int qed_iov_vf_update_mac_shadow(struct qed_hwfn *p_hwfn,
for (i = 0; i < QED_ETH_VF_NUM_MAC_FILTERS; i++) {
if (ether_addr_equal(p_vf->shadow_config.macs[i],
p_params->mac)) {
memset(p_vf->shadow_config.macs[i], 0,
ETH_ALEN);
eth_zero_addr(p_vf->shadow_config.macs[i]);
break;
}
}
Expand All @@ -2640,7 +2639,7 @@ static int qed_iov_vf_update_mac_shadow(struct qed_hwfn *p_hwfn,
} else if (p_params->opcode == QED_FILTER_REPLACE ||
p_params->opcode == QED_FILTER_FLUSH) {
for (i = 0; i < QED_ETH_VF_NUM_MAC_FILTERS; i++)
memset(p_vf->shadow_config.macs[i], 0, ETH_ALEN);
eth_zero_addr(p_vf->shadow_config.macs[i]);
}

/* List the new MAC address */
Expand Down

0 comments on commit 0ee28e3

Please sign in to comment.