Skip to contentSkip to conversation

qed: Replace memset with eth_zero_addr

PATCH In review Shyam Saini 2 participants 3 messages Jan 16, 2017 – Jan 17, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qed: Replace memset with eth_zero_addr

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

---
 drivers/net/ethernet/qlogic/qed/qed_l2.c    | 2 +-
 drivers/net/ethernet/qlogic/qed/qed_sriov.c | 7 +++----
 2 files changed, 4 insertions(+), 5 deletions(-)
drivers/net/ethernet/qlogic/qed/qed_l2.c +1 -1
index 6a3727c..778c52c 100644
@@ -1776,7 +1776,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;
 }
drivers/net/ethernet/qlogic/qed/qed_sriov.c +3 -4
index 85b09dd..a15fff4 100644
@@ -1199,7 +1199,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);
 }
 
 static void qed_iov_vf_cleanup(struct qed_hwfn *p_hwfn,
@@ -2539,8 +2539,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;
 			}
 		}
@@ -2553,7 +2552,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 */
Signature · 1 line
2.7.4
maintainer
#1 lore raw

From: Shyam Saini <[email protected]>
Date: Tue, 17 Jan 2017 00:21:38 +0530

Quoted 5 lines

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

This patch does not apply cleanly to the net-next tree.

Please state if you don't understand what that means instead of submitting this patch over and over again against the wrong source tree.

Thanks.

#2 lore raw
Quoted 10 lines · David Miller

From: Shyam Saini <[email protected]>
Date: Tue, 17 Jan 2017 00:21:38 +0530

Quoted 5 lines

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

This patch does not apply cleanly to the net-next tree.

I always send patches from linux-next tree and that caused this mistake

I apologize for this.

Quoted 3 lines

Please state if you don't understand what that means instead of submitting this patch over and over again against the wrong source tree.

Now sent from net-next tree

Thanks a lot,
Shyam